Hi Guys,

In our environment reboot is a major concerns on workstations resulting in non compliance. We need a script which will remotely reboot the workstation but we need to ensure that enduser after 5 log off and login or in hibernate mode once comes on on the 6 time even enduser tries to log off give a message to close all apllication and forcefully restart the machine.



Answer Summary:
0 Comments   [ - ] Hide Comments


Please log in to comment

Community Chosen Answer



i use autohotkey to compile a exe, and then push it via psexec or a logon script.

MsgBox, 4144, Message From Administrator, Your Computer needs to restart. Please Press OK to restart now.
Shutdown, 6

The "4144" makes it so that the user can only press ok and it stays on top.  "Shutdown,6" restarts the computer without interuptions.
Then use psexec like so to push it to the user (assuming your admin on a domain)...

psexec.exe \\ComputerName -s -i -f -c C:\reboot.exe

where C:\reboot.exe is where you compiled your autohotkey script.

Answered 07/05/2012 by: aaronbaird1
White Belt

Please log in to comment
Answer this question or Comment on this question for clarity



You can download a pshutdown from microsoft (sysinternals).


Answered 07/03/2012 by: sivhead
White Belt

Please log in to comment

If its a script you wanted then you can use the following

Set WSHShell = WScript.CreateObject("WScript.Shell") 
Set oFS = CreateObject("Scripting.FileSystemObject")

strWarning = "Due to network maintenance, this computer must be restarted. You have 5 minutes to save your work from the start of this countdown. Sorry for any inconvenience caused. "
strDelay = 300    'Delay given in seconds; change this value to your preference, or set it to 0 to give no delay at all

'Open a text file of computer names
'with one computer name per line
Set oTS = oFS.OpenTextFile("C:\computers.txt")

'go through the text file
Do Until oTS.AtEndOfStream
'get the next computer name
'store it in variable strCompname
strCompname = oTS.ReadLine
        WshShell.Run "C:\Windows\System32\shutdown.exe -m \\" & strCompname & " -r -c " & Chr(34) & strWarning & Chr(34) & " -t " & strDelay    'Replace the "-r" switch with "-s" to make the computers shutdown instead
'close the text file
Answered 07/03/2012 by: sivhead
White Belt

Please log in to comment