Jump to content

Recommended Posts

Posted

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.


Posted (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 by Tripredacus
Posted

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).

Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...