AcidicChip Posted May 16, 2007 Posted May 16, 2007 (edited) I know you can get the current logged in user's name, etc. However I am looking for a way to determine if the computer is at the Windows XP Login/Switch User screen? Edited May 17, 2007 by AcidicChip
Xenobiologist Posted May 16, 2007 Posted May 16, 2007 Hi, does this help? $value = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "AltDefaultUserName") Msgbox(64, "Value", $value) So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
AcidicChip Posted May 16, 2007 Author Posted May 16, 2007 Hi, does this help? $value = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "AltDefaultUserName") Msgbox(64, "Value", $value) So long, Mega That seems to just tell me the default name, and returns it wether I'm at the login screen or actively logged in. I basically want to know when I log out or go into the switch user screen, so that I can just see my lights red to know that my computer isn't open for someone else to just sit down and use it.
ptrex Posted May 16, 2007 Posted May 16, 2007 @AcidicChip Maybe this can help you out. ; ------ SCRIPT CONFIGURATION ------ $strUserDN = "<UserDN>" ; e.g. cn=rallen,ou=Sales,dc=rallencorp,dc=com ; ------ END CONFIGURATION --------- $objUser = ObjGet("LDAP://" & $strUserDN) $objLogon = $objUser.Get("lastLogonTimestamp") $intLogonTime = $objLogon.HighPart * (2^32) + $objLogon.LowPart $intLogonTime = $intLogonTime / (60 * 10000000) $intLogonTime = $intLogonTime / 1440 ConsoleWrite ("Approx last logon timestamp: " & $intLogonTime ) Regards, 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
AcidicChip Posted May 16, 2007 Author Posted May 16, 2007 @ptrexI can't seem to get that to work, I keep getting this errorC:\Documents and Settings\Chance\Desktop\LightFX\LightFX.au3 (20) : ==> Variable must be of type "Object".: $objLogon = $objUser.Get("lastLogonTimestamp") $objLogon = $objUser^ ERROR
ptrex Posted May 16, 2007 Posted May 16, 2007 @AcidicChip You need to be logged into the domain and have admin rights. Where did i read this before ? regards 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
AcidicChip Posted May 16, 2007 Author Posted May 16, 2007 @ptrex I'm not looking for domain users or anything like that being logged in. I guess I should clarify what I want to do. How can I detect if the computer is at the login/user switch screen or not?
Selmak Posted May 16, 2007 Posted May 16, 2007 (edited) How can I detect if the computer is at the login/user switch screen or not?In principle this would work:if WinExists ( 'Program Manager') then $userAuthenticated=1else $userAuthenticated=0endifThe only thing is, to be of any use your script would have to run as a system service, otherwise it will be terminated when the user logs-off, defeating the purpose. Might be possible with the srvany utility.On a similar question, does anyone know how to tell if the screensaver is running? I believe it is possible to do this with a (fairly complex) call to user.exe, but just wondered if I'm overlooking an easier way. Edited May 16, 2007 by Selmak
jefhal Posted May 16, 2007 Posted May 16, 2007 Hi ptrex- The problems that I have with this method is that: a. you have to know the user name b. you only get the login time, but still do not know if the user logged off There are threads all over the web on this very difficult issue. I usually check to see if a machine is in use before taking control of it with Dameware. However, the data I get back is often wrong. I use psloggedon from sysinternals (now microsoft), and I have recently tried by checking sessions on the main server, but this is incredibly slow. The one solution that people end up offering is to write a script(s) that creates a database of users logging on and logging off computers. Even this method is not foolproof, for example, when a user just shuts down the computer with the power button. The database shows him logged on, but he has already left the building! jefhal ; ------ SCRIPT CONFIGURATION ------ $strUserDN = "<UserDN>" ; e.g. cn=rallen,ou=Sales,dc=rallencorp,dc=com ; ------ END CONFIGURATION --------- $objUser = ObjGet("LDAP://" & $strUserDN) $objLogon = $objUser.Get("lastLogonTimestamp") $intLogonTime = $objLogon.HighPart * (2^32) + $objLogon.LowPart $intLogonTime = $intLogonTime / (60 * 10000000) $intLogonTime = $intLogonTime / 1440 ConsoleWrite ("Approx last logon timestamp: " & $intLogonTime ) ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
MHz Posted May 17, 2007 Posted May 17, 2007 I know you can get the current logged in user's name, etc.@Username normally comes up empty when no one is logged on.
AcidicChip Posted May 17, 2007 Author Posted May 17, 2007 Is there some sort of object class, window title/text i can look for that would determine that the computer is at the login/user switch screen?
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