|
This function determines if there are patches being installed. Example: C:\>cscript //nologo Function_PatchesInstalling.vbs No patches are being installed.
C:\>
'****************************************************************** ' Function PatchesInstalling() ' ' Checks if updates are currently being installed '****************************************************************** Function PatchesInstalling() On Error Resume Next Dim objSystemInfo Dim flgPatchesInstalling flgPatchesInstalling = False Set objSystemInfo = WScript.CreateObject("Microsoft.Update.Installer") If Err.Number <> 0 Then Wscript.Echo "Error creating [Microsoft.Update.Installer] object 0x" & Right("0000000" & Hex(Err.Number), 8) & ": " & Err.Description Err.Clear End If flgPatchesInstalling = objSystemInfo.IsBusy Set objSystemInfo = Nothing PatchesInstalling = flgPatchesInstalling End Function '************* Example ************* If PatchesInstalling() Then Wscript.Echo "Patches are being installed." Else Wscript.Echo "No patches are being installed." End If
|