We still have some windows server 2003 servers without powershell. We have a need to install SCCM updates with vbscript. I can instantiate the updates, but I am not able to call the installupdates WMI method for CCM_SoftwareUpdatesManager
Here is what I have
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\ccm\ClientSDK")
Set objInstall = GetObject("winmgmts:\\" & strComputer & "\root\ccm\ClientSDK:CCM_SoftwareUpdatesManager")
Set colItems = objWMIService.ExecQuery("SELECT * FROM CCM_SoftwareUpdate WHERE ComplianceState=0", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
'----Get the Patch ID
WScript.Echo "BulletinID: " & objItem.BulletinID
WScript.Echo
' ---- Install the patch
Set UID = objInstall.Methods_("InstallUpdates")
UID = objInstall.InstallUpdates(objItem.BulletinID)
Next
This is the error I am receiving:
SWbemObjectEx: Type mismatch
Thanks in advance for the help. I have not done any work in vbscript for a while...