blakel Posted April 6, 2010 Posted April 6, 2010 I am looking for a solution to tell me what a user selects from the Windows shutdown menu. 1) Logoff 2) Restart 3) Shutdown 4) Shutdown and install updates (Not worried about hibername, etc.) With this, I can select good times to do maintenance, etc. Using WM_ENDSESSION, I can tell if the system is going to logoff or if the system is being (shutdown or restarted) (ie does not inform the window if the system is being shutdown or restarted, just that one of the two is happening.) The system shutdown script, as commonly edited by gpedit, also does not distinguish between a shutdown or restart. Finally, there is a registry entry that the logoff screen changes to save the choice of the user, so that it is default next time. It appears that this was removed in WinXP. Does anyone know of a function in the WinAPI or WMI that may provide that information? Other ideas? I would like to use this for WinXP, WinVista, Win7. Primarily interested in the user's choice. If Automatic Updates or MSI initiates a reboot then I am not particularly concerned about that. Thanks.
ptrex Posted April 7, 2010 Posted April 7, 2010 @blakel One way of doing this to use a WMI Monitor on the Eventlog. There are certain events logged for shutdown, logoff, restart etc. Here is an example on how to setup the eventlog for Logoff/on actions http://technet.microsoft.com/en-us/library/bb742436.aspx There are enough examples on the forum in how to do WMI Eventlog Monitoring, I guess Rgds, ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
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