Jump to content

Trigger Maintenance Mode via Script/Task


ComputerConsulting
 Share

Recommended Posts

It would be helpful to be able to enable maintenance mode in a script and disable it in another script.  

See if this makes sense.

 

Script 1 = turns on maintenance mode

Script 2 = reboots computer

Script 3 = turns off maintenance mode

 

Would this work, and how would one do this?  This would be a lot simpler than setting a time for maintenance mode in the agent and be more useful since maintenance mode wouldn't depend on a time, but on a script no matter when it runs.

Link to comment
Share on other sites

  • Administrators

I doubt that script 3 will execute. We don't continue a task execution after a reboot. If you need to schedule a reboot for your systems I recommend you to configure the Maintenance Schedule on your machines (can also be done via a Pulseway Group Policy).

Powershell to control the maintenance mode:

Set-ItemProperty -Path "HKLM:\Software\MMSOFT Design\PC Monitor" -Name "MaintenanceMode" -Value "1"

-Paul

Link to comment
Share on other sites

22 minutes ago, Paul said:

I doubt that script 3 will execute. We don't continue a task execution after a reboot. If you need to schedule a reboot for your systems I recommend you to configure the Maintenance Schedule on your machines (can also be done via a Pulseway Group Policy).

Powershell to control the maintenance mode:


Set-ItemProperty -Path "HKLM:\Software\MMSOFT Design\PC Monitor" -Name "MaintenanceMode" -Value "1"

-Paul

 
 

Why wouldn't script 3 work?  The value would = 0 instead of 1 to turn it off again.  I'll have to test it, but wouldn't issuing a registry entry via the powershell overwrite the previous entry with value = 1 with the value = 0?

I could set a powershell script to execute for all my nodes at a certain time each morning to make sure all nodes are NOT in maintenance mode.

Wouldn't it also work, if I split it into two tasks instead of one?  The first task would set maintenance mode on do what it needs to do, and then reboot.

The second task timed to run 30 minutes later would then take the computer or computers out of maintenance mode.

One more question about my post above:

After changing the registry entry, would that require a reboot or will the Pulseway Agent see that the registry has been changed, and act accordingly?

Edited by ComputerConsulting
I have ADHD and I drink.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...