These powershell scripts will put your server or group of servers in Full Maintenance Mode or (Offline Maintenance Mode).
They will put the Server, the Health Service on that server and the Health Service Watcher into maintenance mode. (Essentially all objects related to a server)
Usage for Groups (All one Line)
GroupMaintenanceMode.ps1 –rootMS: ‘omrms1.contoso.com’ -groupName: ‘_AU 3AM Sunday Reboot’ –numberOfHoursInMaintenanceMode:4 -comment:’_AU 3AM Sunday Reboot MaintenanceMode‘
Usage for Individual Servers (All one Line)
AgentMaintenanceMode.ps1 –rootMS: ‘omrms1.contoso.com’ -computerPrincipalName: ‘ql1tmactest1.mi.corp.rockfin.com’ -numberOfHoursInMaintenanceMode:4 -comment:’ql1tmactest1.mi.corp.rockfin.com MaintenanceMode’
http://timothymcfadden.googlepages.com/FullMaintenanceMode.zip
These scripts are just modified versions of the great powershell scripts created by Boris yanushpolsky.
Is there a way to do a powershell script that would automatically place a server into full maintenance mode if the Root Management Server received an alert that the server was sent a shutdown command?
So what I want is to have a server generate an alert when an administrator sends it a shutdown command. I setup a monitor to alert when event id 1074 by USER32 is generated in the system event viewer. But once the Root Management Server gets that alert, I want it to place that agent/heathservice/server into maintenance mode.
If I created a powershell script on the RMS that was setup as a recovery in the alert was what I was thinking, but could the server shutdown too fast to get the recovery to go?
And what would the script look like would be my other question.