Jump to content

Recommended Posts

Posted

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.

  • Administrators
Posted

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

Posted (edited)
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.
  • Administrators
Posted

If you configure two tasks then it will work. The registry change is detected within 15 seconds.

-Paul

Posted
3 minutes ago, Paul said:

If you configure two tasks then it will work. The registry change is detected within 15 seconds.

-Paul

 
 

Excellent.  That was the answer I was looking for, and can't wait to try it.

Now for the icing on the cake:

 

How do I make a script pause for 15 seconds?

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
×
×
  • Create New...