Anyone know why the InstallDate is always blank on WinXP?
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer &
"\root\cimv2")
Set colQuickFixes = objWMIService.ExecQuery _
("Select * from Win32_QuickFixEngineering")
For Each oQF in colQuickFixes
wscript.echo oQF.HotFixID & " - " & oQF.InstallDate & " - " &
oQF.InstalledOn & " - " & oQF.Description
Next
Output:
Q815021 - - - Windows XP Hotfix (SP2) Q815021
Q817287 - - - Windows XP Hotfix (SP2) Q817287
Q817606 - - - Windows XP Hotfix (SP2) Q817606
Dates missing. What's up?
I notice in the registry the field is called InstalledDate, not
InstallDate, but of course that property doesn't exist. There's also
an InstalledOn property which is also blank.
This has been confirmed here:
AW :)
Here is a partial workaround. You can use the registry provider to get those
InstalledDate values that exists in the registry. Here is a mof that you can
modify/try.
(Note this is a just a sample mof and you may not have these hotfixes
installed and thus there maybe no instances. You can modify the registry
keys in the ClassContext to point to the hotfixes that you are interested
in)
qualifier dynamic:ToInstance;
qualifier ProviderClsid:ToInstance;
qualifier ClassContext:ToInstance;
qualifier propertycontext:ToInstance;
[dynamic, provider("RegProv"),
ProviderClsid("{fe9af5c0-d3b6-11ce-a5b6-00aa00680c3f}"),
ClassContext("local|HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Updates\\DataAc
cess")
]
class Updates {
[key] string KeyName;
[read, propertycontext("Description")] string Description;
[read, propertycontext("InstalledDate")] string InstalledDate;
};
[dynamic, provider("RegProv"),
ProviderClsid("{fe9af5c0-d3b6-11ce-a5b6-00aa00680c3f}"),
ClassContext("local|HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Updates\\Window
s XP\\SP1")
]
class UpdatesXP {
[key] string KeyName;
[read, propertycontext("Description")] string Description;
[read, propertycontext("InstalledDate")] string InstalledDate;
};
After compiling this mof, you can go to root\default namespace and enum
instances with the dates for the classes (in this case Updates and
UpdatesXP). Hope this helps.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Andrew Williamson" <andrew...@mailinator.com> wrote in message
news:62a595cc.04021...@posting.google.com...
Thanks for the confirmation and workaround :)
Rgds
AW
This got me thinking and looking around a little more. In
%SYSTEMROOT%\WBEM, I found the file cimwin32.mof which contained the
following section:
[Dynamic,Provider("CIMWin32") : ToInstance,Locale(1033) :
ToInstance,UUID("{0827250D-BA3E-11d2-B361-00105A1F77A1}") :
ToInstance]
class Win32_QuickFixEngineering : CIM_LogicalElement
{
[read : ToSubclass,key : ToInstance ToSubclass
DisableOverride,MaxLen(260) :
ToSubclass,MappingStrings{"Win32Registry|SOFTWARE\\Microsoft\\Windows
NT\\CurrentVersion\\Hotfix"} : ToSubclass] string HotFixID;
[read : ToSubclass,key : ToInstance ToSubclass
DisableOverride,MaxLen(260) :
ToSubclass,MappingStrings{"Win32Registry|SOFTWARE\\Microsoft\\Windows
NT\\CurrentVersion\\Hotfix"} : ToSubclass] string ServicePackInEffect;
[read : ToSubclass,CIM_Key : ToSubclass,MaxLen(256) :
ToSubclass,Propagated("CIM_ComputerSystem.Name") :
ToSubclass,MappingStrings{"WMI"} : ToSubclass]
string CSName;
[read : ToSubclass,MappingStrings{"Win32Registry|SOFTWARE\\Microsoft\\Windows
NT\\CurrentVersion\\Hotfix"} : ToSubclass] string FixComments;
[read : ToSubclass,MappingStrings{"Win32Registry|SOFTWARE\\Microsoft\\Windows
NT\\CurrentVersion\\Hotfix"} : ToSubclass] string InstalledBy;
[read : ToSubclass,MappingStrings{"Win32Registry|SOFTWARE\\Microsoft\\Windows
NT\\CurrentVersion\\Hotfix"} : ToSubclass] string InstalledOn;
};
We can see there that InstalledOn is mentioned, but there doesn't
appear to be a mapping back to the registry. I tried changing that to
InstalledDate and running it through mofcomp on a spare machine, but I
got an error:
C:\WINDOWS\system32\wbem>mofcomp -class:createonly cimwin32.mof
Microsoft (R) 32-bit MOF Compiler Version 5.1.2600.1106
Copyright (c) Microsoft Corp. 1997-2001. All rights reserved.
Parsing MOF file: cimwin32.mof
Error, cannot combine autorecover with current flags/pragmasCompiler
returned error 0x0
Am I barking up the wrong tree here? Obviously, I'm fiddling around in
the dark a little - should this work however?
Thanks in advance :)
AW
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Andrew Williamson" <andrew...@mailinator.com> wrote in message
news:62a595cc.04021...@posting.google.com...
The problem with my using that workaround is that this is a process I
need to run on remote machines. Not sure that this will work in those
circumstances.
Upon completion of the operation, you should be able to access the classes
with a script.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Andrew Williamson" <andrew...@mailinator.com> wrote in message
news:62a595cc.04021...@posting.google.com...