A user was looking for a way to reboot a server after an Event Viewer error had triggered maintenance mode and logged out all users. It was suggested to use two triggers – the first would put the server into maintenance mode and set a registry key, and the second would check the registry key and if it was present, reboot the server. The use of a PowerShell script was offered to create the registry key in the first trigger. To ensure that only servers with the 1005 error code were rebooted, the registry key would need to be checked.
Read the entire ‘Automating a Reboot with Two Triggers in ControlUp’ thread below:
Is there a way to incorporate a trigger to reboot a machine once another trigger has activated? For example, I want to reboot a machine after the first trigger detects an error in Event Viewer that places the server into maintenance mode and logoff all disconnected sessions. Then, once there are no users left, I want the server to reboot. Is that possible?
You can make the trigger based on an event log.. like.. if event log is found then… have the second triggers condition then check if there are no logged on users and verify that the server is in maintenance mode… it would be a bit of a mess though. You would need to verify a few different things in order for them to work after the other and not run on items you don’t want it to run
@member you have a better solution?
I have an Advanced trigger to reboot machines but I cannot add anything from Event Viewer from the Filter Editor in order to detect the error
2 steps should work:
trigger 1 : place in maintenance on event
trigger 2 : if maintenance mode and usersessions = 0 for > xx minutes run reboot script thatmight have some extra checks
Right – I just want to ensure the servers that are being rebooted also have the 1005 error code in Event Viewer
To avoid rebooting servers that just have maintenance mode on and 0 sessions
you could have the first one also set a registry key for example that the second one checks and clears in the script.
and only does the reboot with the key in place
oh good idea
How would I be able to do that with the first trigger?
https://devblogs.microsoft.com/scripting/use-powershell-to-easily-create-new-registry-keys/ in an SBA that runs on the target machine
Continue reading and comment on the thread ‘Automating a Reboot with Two Triggers in ControlUp’. Not a member? Join Here!
Categories: All Archives, ControlUp Scripts & Triggers