Patch Management - SMS to schedule the server reboot after patches deployed by ITMU
We use ITMU to deploy the patches to all the servers at the same time. Normally we will suppress the reboot during the patching process. We will use SMS to schedule the reboot afterwards depending on the maintenance window we get from the server owners.
We create an advertisement to deploy the following VB script to the targeted collection:
First it will check c:\temp and if not exist - create c:\temp and then it will append or create Rebootlog in c\temp;
Per our Notes Admin's request, I add the function to check the Lotus Domino Server Service and stop the service before let SMS reboot the server.
Vbs Script:
Option Explicit
On Error Resume Next
Dim strDir
Dim strFile
Dim objFSO
Dim objFolder
Dim LogFile
Const ForWriting = 2
Const ForAppending = 8
Dim objFile
Dim objWMIService
Dim colRunningDataServices
Dim objDataService
strDir = "C:\Temp"
strFile = "\Rebootlog.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists (strDir) Then
checkLog
Else
Set objFolder = objFSO.CreateFolder(strDir)
checkLog
End if
Set objWMIService = GetObject("winmgmts:root\cimv2")
Set colrunningDataServices = objWMIService.ExecQuery _
("Select * From Win32_Service Where name = 'Lotus Domino Server' or name = 'Lotus Domino Server (Data)'and state = 'running'")
For Each objDataService in colrunningDataServices
objDataService.StopService()
Next
WScript.Sleep 5*60*1000
Wscript.quit
'****************************************************************************************
Sub checkLog
LogFile = strDir & strFile
Const ForWriting = 2
Const ForAppending = 8
If objFSO.FileExists(LogFile) Then
Set objFile = objFSO.OpenTextFile(LogFile, ForAppending)
objFile.Write vbCrLf & "SMS will Reboot Server 5 Minutes After " & Now
Else
Set objFile = objFSO.CreateTextFile(LogFile)
objFile.Close
Set objFile = objFSO.OpenTextFile(LogFile, ForWriting)
objfile.write "SMS will Reboot Server 5 Minutes After " & now
End If
objFile.Close
End Sub