Jump to content
pablohoney

Restart Script

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...