pablohoney Posted June 29, 2017 Posted June 29, 2017 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.
Administrators Paul Posted July 4, 2017 Administrators Posted July 4, 2017 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
pablohoney Posted July 5, 2017 Author Posted July 5, 2017 Thanks Paul. So where you have "-ComputerName Quark" I'm guessing Quark must be replaced by the actual name of the computer?
pablohoney Posted July 5, 2017 Author Posted July 5, 2017 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. Paul 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now