Jump to content

Restart Script


pablohoney

Recommended Posts

I've tried a couple of recommendations around the web for powershell and batch for restarting a Windows machine. Each script seems to work fine on all machines with the exception of one workstation that seems to shutdown only and not perform a restart - when the scheduled task is ran via Pulseway.

Has anyone ever experienced this - where the machine simply shuts down vs restarting? Also, is there a reliable Windows restart script that anyone can share? Thank you.

Link to comment
Share on other sites

  • Administrators

What command are you running to restart the operating system? Is it a simple:

shutdown -r -f -t 00

If so, try to restart the OS via WMI:

Get-WmiObject win32_operatingsystem -ComputerName Quark | Invoke-WMIMethod -name Win32Shutdown -ArgumentList @(6)

-Paul

Link to comment
Share on other sites

On 7/4/2017 at 5:55 AM, Paul said:

What command are you running to restart the operating system? Is it a simple:


shutdown -r -f -t 00

If so, try to restart the OS via WMI:


Get-WmiObject win32_operatingsystem -ComputerName Quark | Invoke-WMIMethod -name Win32Shutdown -ArgumentList @(6)

-Paul

 

The script above looks good on a test machine. I'll test it out tonight on the one that's simply shutting down only and let you know. Thanks again.

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