darin_essex Posted April 13, 2008 Posted April 13, 2008 Hi All,I have a strange problem with Group Policy shutdown scripts- I have a c# program that calls an INITIATESYSTEMSHUTDOWN command on a bunch of remote Windows XP PCs to shut them down in the evening. This works fine, but ..... the group policy shutdown scripts do not run if the PCs are shut down in this fashion!If you walk up to one of these PCs and press the power button on the front of the system, then the PC shuts down but DOES process the shutdown scripts. Likewise, if the PC is logged on at the time the INITIATESYSTEMSHUTDOWN command is sent, then the scripts DO run before the PC shuts down!I thought the problem may be with the INITIATESYSTEMSHUTDOWN call, but if I remotely shut down the PCs using SHUTDOWN.EXE from the NT resource kit, I get the same result, the scripts do not run!!This is very perplexing. Does anyone have any ideas? The local eventlogs on the PCs dont log any errors about this.
Tripredacus Posted April 14, 2008 Posted April 14, 2008 (edited) Yea they definately won't run the logoff scripts. Your function is calling the "force shutdown" action that you normally can see being run by NTAUTHORITY/SYSTEM. You will be better off using comspec for "shutdown -r -t 30" where -r is restart, and -t is time, and 30 is 30 seconds, but you can use any sort of time delay you wish. This option should run your logoff scripts. If that still isn't working, try "shutdown -i -r -t 30" Edited April 14, 2008 by Tripredacus
cluberti Posted April 14, 2008 Posted April 14, 2008 Are you utilizing the bForceAppsClosed == True in your call? Also, just an FYI, but using the ExitWindowsEx function provides the logoff+shutdown/reboot functionality, and should be used instead of InitiateSystemShutdown function unless you want to do this remotely (ExitWindows is a local API only).
darin_essex Posted April 14, 2008 Author Posted April 14, 2008 All,I have tried the shutdown with both the bForceAppsClosed set to true and false but it makes no difference. Also, the idea is to power off the PCs remotely so a reboot and an ExitWindows call are out of the question.Thanks for your help.
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