|
ReadDiffOSRegKey
Returns values in the registry keys matching the OS
the script should be executed by cscript in a command shell
' Build by Torben Jørgensen T-Systems Denmark 22-08-2003 23:13:00"
' For Mærsk Container Buisness Global Infrastruktur (MCBGIS)
'__________________________________________________________________
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
If objOperatingSystem.Caption = "Microsoft Windows 2000 Professional" then
strKeyPath = "SOFTWARE\Microsoft\Updates\Windows 2000\SP5\KB823980"
strOS = objOperatingSystem.Caption
end if
If objOperatingSystem.Caption = "Microsoft Windows XP Professional" then
strKeyPath = "SOFTWARE\Microsoft\Updates\Windows XP\SP2\KB823980"
strOS = objOperatingSystem.Caption
end if
Next
strValueName1 = "InstalledDate"
strValueName2 = "InstalledBy"
oReg.GetExpandedStringValue HKEY_LOCAL_MACHINE,strKeyPath,_
strValueName1,strValue1
oReg.GetExpandedStringValue HKEY_LOCAL_MACHINE,strKeyPath,_
strValueName2,strValue2
If strValue1 <> "" then
StdOut.WriteLine strOS & "\KB823980 installed " & strValue1 & " by " & strValue2
else
StdOut.WriteLine "The " & strOS & "\KB823980 IS_NOT_INSTALLED NB! NB!"
StdOut.WriteLine "Contact systemadministrator!!!!! 8651"
end if
if Err.Number <> 0 then
StdOut.WriteLine "Error nr. " & Err.Number
StdOut.WriteLine Err.Description
end if
StdOut.WriteLine ""
StdOut.WriteLine "Executed " & NOW
'"." is localhost fill in the remote PC name to check a PC in your network
'When using the "WScript.StdOut" (StdOut.WriteLine) methode
'(as I'm dooing here) the script should be called from a command shell with cscript.
'Like this "cscript script_name.vbs"
|