Solved

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

Posted on 2009-07-14
8
1,130 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
 
LVL 37

Expert Comment

by:Bing CISM / CISSP
ID: 24889069
agree with dan_blagut, better use "shutdown -r -m \\computername".
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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:Bing CISM / CISSP
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:
Bing CISM / CISSP 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
ports for sccm 2012 1 63
WSUS Feature Updates for WIndows 10 6 60
RDP up only between 8am-13.00 pm ? 11 66
JItbit AD intergration 4 45
In this guide, I outline 7 key steps to help technology professionals grow their careers. Whether you have been working in technology for 10 years or for 10 days, follow these steps to help you achieve your career goals and pursue your passions.
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now