Hi,
is there a suggested way of automatically enabling maintenance mode for a server on shutdown or reboot?
I kind of got it working with a shutdown script (over local policy for dev; GPO probably will be used for prod deployment) and locally installed scom PS "operationsmanger" module. Unfortunately I had to put the logon credentials into the script to get it working. Is there a way to trigger this as scheduled task on server shutdown so the creds don't need to be put into the script (getting a proper user context over the task)?
Will the SCOM recognize a Windows event on shutdown fast enough, so the script for enabling maintenance mode could run on the SCOM server?
I tried to trigger the script locally on the rebooting server over an event log entry like this one:
Log Name: System
Source: USER32
Date: 04.02.2014 14:09:05
Event ID: 1074
Task Category: None
Level: Information
Keywords: Classic
User: SERVICES\e34348
Computer: S01404020.services.dekra.com
Description:
The process C:\Windows\system32\winlogon.exe (S01404020) has initiated the restart of computer S01404020 on behalf of user SERVICES\e34348 for the following reason: No title for this reason could be found
Reason Code: 0x500ff
Shutdown Type: restart
Comment:
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="USER32" />
<EventID Qualifiers="32768">1074</EventID>
<Level>4</Level>
<Task>0</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2014-02-04T13:09:05.000000000Z" />
<EventRecordID>62176</EventRecordID>
<Channel>System</Channel>
<Computer>S01404020.services.dekra.com</Computer>
<Security UserID="S-1-5-21-4220481026-135224086-419363850-8148" />
</System>
<EventData>
<Data>C:\Windows\system32\winlogon.exe (S01404020)</Data>
<Data>S01404020</Data>
<Data>No title for this reason could be found</Data>
<Data>0x500ff</Data>
<Data>restart</Data>
<Data>
</Data>
<Data>SERVICES\e34348</Data>
<Binary>FF000500000000000000000000000000000000000000000000000000000000000000000000000000</Binary>
</EventData>
</Event>
unfortunately that did not work. Would SCOM be able to hadle such an event and run a script to enable maintenance mode before errors of the servers services pop up?
Disabling maintenance mode after boot up works fine over a scheduled task with trigger "at system startup". No need to put the credentials into the script there.
Thanks for your support,
Christoph Ellinger