I have tried that as well...but the log off seems to take prevalence over the psshutdown and the computer never gets rebooted.
Main Topics
Browse All TopicsI have the following script that when executed force a Windows computer to reboot.
If I manually run the script the computer reboots fine. If I run the script on when the user logs off
(via GPO).
I get the error message shown in the picture.
Does anybody know how to modifiy this script so I don't get the error message and the forced reboot gets completed?
Or any other script that I can use to force a reboot so far I have tried with these two but neither worked when applied to a log off:
1.)
Set OpSysSet = GetObject("winmgmts:{(Shut
for each OpSys in OpSysSet
OpSys.Reboot()
next
2.)
Dim oShell
Set oShell = CreateObject("WScript.Shel
oShell.Run "%comspec% /c shutdown /r /t 5 /f", , TRUE
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hello there
I found this and wondered if it may help you?
These settings control what action the system should take when the Logoff and Shutdown commands are used.
Open your registry and find or create the key below.
User Key: HKEY_CURRENT_USER\Software
Value Name: LogoffSetting, ShutdownSetting
Data Type: REG_DWORD
Create or modify the two DWORD values called "LogoffSetting" and
"ShutdownSetting" according the values from the list below.
* 0 - Log Off
* 1 - Shutdown
* 2 - Shutdown and Restart
* 3 - Shutdown and Power Off
Log off or restart Windows for the changes to take effect.
Hope this helps. If it works then I can provide a script to set all machines registry value as required via either a GPO, Logon Script or a remote registry script - whichever option (or other option I'v enot mentioned) is best for you. :-)
Regards
Krystian
Thanks for you reply.
I have created Shutdown Key (it wasn't there before) (User Key: HKEY_CURRENT_USER\Software
and the 2 values as follow:
Value Name: LogoffSetting, ShutdownSetting
Data Type: REG_DWORD
I have entered
LogoffSetting = 2
ShutdownSetting = 1
Then reboot the machine...
Is that correct?
Ok this works
http://www.microsoft.
you
save below as restart.bat and use as your logoff script
I've manually tried the command and seemed to work fine. The soon.exe scheduled an AT task and peformed a reboot.
I have tried to create the .bat file and pasted the line of code (before I copied the soon.exe over system32) when I run the bat file it doesn't seemed to work I get into a loop where the line of code repeats over and over again (I can see that on the MS shell window).
I have removed the "cd\"
and modify the line of code adding .exe (soon.exe \\%computername% 60 /interactive shutdown -r -t 5)
...now works fine with GPO.
So I was missing the .exe and the "\cd" was messing the whole thing up.
Anyway if you or anybody knows how to reestart with a script while loging off via GPO I would appreciate any comments. I still can't believe that is not working...or that I am the only one trying to do that.
Thank you for very much for your help.
Business Accounts
Answer for Membership
by: leakim971Posted on 2009-10-31 at 15:47:02ID: 25711907
Hello llarava,
om/en-us/s ysinternal s/ bb897541 .aspx
You can run psshutdown directly or with VBScript : http://technet.microsoft.c
Regards.