Windows Updateの実行vbsをタスクスケジューラに投入して夜間に実行しているのですが、
Windows Server2016で動作している同じvbsがWindows Server2008R2のサーバでは実行されません。
タスクスケジューラの同タスクの履歴では正常に完了していることがイベントID102で確認されています。
他にシステム再起動タスクもあるのですが、それはServer2008R2のサーバも問題なく動作しております。
その為、Windows Updateの実行vbsの中身に原因があるのかもしれない、と疑っておりますが、よく中身を分かっておらず、前任者が辞めております。
以下にVBSを添付しますので、2008R2では実行されない記述があれば、教えていただけないでしょうか?
宜しくお願い致します。
~~~~~~~~~~~~~~
Set updateSession = CreateObject("Microsoft.Update.Session")
Set updateSearcher = updateSession.CreateupdateSearcher()
updateSearcher.Online = False
'WScript.Echo "Searching for updates..." & vbCRLF
Set searchResult = _
updateSearcher.Search("IsInstalled=0 and Type='Software'")
Set updatesToInstall = CreateObject("Microsoft.Update.UpdateColl")
'WScript.Echo vbCRLF & _
'"Creating collection of downloaded updates to install:"
For I = 0 To searchResult.Updates.Count-1
set update = searchResult.Updates.Item(I)
If update.IsDownloaded = true Then
' WScript.Echo I + 1 & " adding: " & update.Title
updatesToInstall.Add(update)
End If
Next
'WScript.Echo "Downloaded updates to install count: " & updatesToInstall.Count
If updatesToInstall.Count = 0 Then
' WScript.Echo "No updates to install."
WScript.Quit
End If
'WScript.Echo "Installing updates..."
Set installer = updateSession.CreateUpdateInstaller()
installer.Updates = updatesToInstall
Set installationResult = installer.Install()
'WScript.Echo "Installation Result: " & _
'installationResult.ResultCode
'WScript.Echo "Reboot Required: " & _
'installationResult.RebootRequired & vbCRLF
'WScript.Echo "Listing of updates installed " & _
' "and individual installation results:"
For I = 0 to updatesToInstall.Count - 1
' WScript.Echo I + 1 & " " & _
' updatesToInstall.Item(i).Title & _
' ": " & installationResult.GetUpdateResult(i).ResultCode
Next
WScript.Quit
~~~~~~~~~~~~~~