Solved

How to Reboot at Log Off - Windows Server 2003 w/ GPO?

Posted on 2009-07-14
8
1,133 Views
Last Modified: 2013-12-04
I have a script that I need to have ran when a User logs off.  This script will have the computer Reboot.  If I create a Shortcut on the Desktop to this script, the unit will Reboot / Restart without issue.  However, when I link to this script in the GPO (Windows Server 2003), the User logs off and the script does not seem to be applied.  Here is the script I am using:

1:  Set OpSysSet = GetObject("winmgmts:{(Shutdown)}//./root/cimv2").ExecQuery("select * from Win32_OperatingSystem where Primary=true")
2:  for each OpSys in OpSysSet
3:  OpSys.Reboot()
4:  next

If I am going in the wrong direction, what do I need to do to make it so I can have a specified Domain Account Reboot / Restart at Logoff?

Thanks!
0
Comment
Question by:technician4321
8 Comments
 
LVL 23

Expert Comment

by:rhandels
ID: 24856890
Are you sure the policy is actually applied to the user?? Did you do an RSOP in the GPMC to check and see if he gets that policy??
0
 
LVL 21

Expert Comment

by:dan_blagut
ID: 24857503
Hello

Or you can do a simply bat script with the shutdown command like
shutdown -r now
and maybe a little pause command before just for looking if the script is executed.
If the command is not executed try to look on the GPO why is not.

Dan
0
 

Author Comment

by:technician4321
ID: 24858642
The GPO is attatched to the Domain and is Enforced.  This one test user is the only User that the GPO is being applied to.  The Script is listed under User Configuration > Windows Settings > Scripts > Logoff.  When the User Logs Off, "Applying Logoff Scripts" pops up on the screen, but instead of rebooting, the unit returns to the Log On Screen.

Thanks!
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
LVL 37

Expert Comment

by:bbao
ID: 24889069
agree with dan_blagut, better use "shutdown -r -m \\computername".
0
 

Author Comment

by:technician4321
ID: 24894410
The User Account that this will be applied to accesses multiple computers.  I am wanting it to Reboot whenever they log off, no matter what computer the Account  logs onto.  

Thanks!
0
 
LVL 37

Expert Comment

by:bbao
ID: 24894931
> I have a script that I need to have ran when a User logs off.

it seemed that your requirement was: to restart the computer when a user logs off (from the *on* status), not when the user is logged off. :-)

pleas be aware that this kind of GPO is only applicable when the user is logged on. so if you are talking about "w/GPO", it implies that the user should be logged on already.

> shutdown -r -m \\computerA

if an administrator runs this command from computer B, it can restart computer A remotely, even no user logged on there. of course, the command does need administrative privilege.

hope it helps,
bbao
0
 

Author Comment

by:technician4321
ID: 24895284
I guess I am wanting the same action that can be done with Windows SteadyState.  I want the "Restart computer after log off", but I want it to be applied to a Domain Account.

Is this possible?

Thanks!
0
 
LVL 37

Accepted Solution

by:
bbao earned 500 total points
ID: 24896722
yes. you can do it with Windows SteadyState, by applying the relevant domain policies.

according to Windows SteadyState Handbook, "If you use Group Policy and Software Restrictions Policies, use a logoff script to reproduce the Restart computer after log off option, commonly located under General Settings in Windows SteadyState"

please be aware that it is actually implemented by adding "shutdown -r -t 00" into the script, as we discussed above.

"You can also use the ForceLogoff.exe tool included with Windows SteadyState to restart the computer."

FYI - Windows SteadyState Handbook
http://download.microsoft.com/download/d/2/6/d261b347-2f03-4bcf-8240-8b7a66beef8a/Windows%20SteadyState%20Handbook.pdf

hope it helps,
bbao
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

OfficeMate Freezes on login or does not load after login credentials are input.
There's a better way to communicate time sensitive or critical info.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa‚Ķ

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question