1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| Sub InstallAllUpdates()
' Initialize the variables.
dim updatesDeployment
dim progress
dim updateCount
dim update
dim updatesList
' Create the UpdatesDeployment instance.
set updatesDeployment = CreateObject ("UDA.CCMUpdatesDeployment")
' Get the current updates.
Set updatesColl = updatesDeployment.EnumerateUpdates( 2, 0, progress )
' Get a count of the available updates.
updateCount = updatesColl.GetCount()
' Before installing, determine whether another job is already in progress.
if progress = 0 then
if updateCount > 0 then
' Create array to hold update IDs.
Redim updatesList(updateCount-1)
' Get the ID for each update.
for nIndex = 0 To updateCount-1
Set update = updatesColl.GetUpdate(nIndex)
updatesList(nIndex) = update.GetId()
next
' Download and install the update and check the location before initiating the download.
updatesDeployment.InstallUpdates updatesList, 0, 8
infodownloadinstall.innerHTML = "Successfully started installation of the updates."
else
infodownloadinstall.innerHTML = "No updates need to be installed."
end if
else
infodownloadinstall.innerHTML = "Another update installation is in progress."
end if
End Sub |
Partager