Wanzler Posted August 17, 2005 Share Posted August 17, 2005 I would like that a function of the Script, only then starts if the user logs out. Is it possible, or have I to write another script ? Link to comment Share on other sites More sharing options...
seandisanti Posted August 17, 2005 Share Posted August 17, 2005 I would like that a function of the Script, only then starts if the user logs out. Is it possible, or have I to write another script ?<{POST_SNAPBACK}>if the script runs the whole time, i'm not sure how to do that, besides to have them log out through the script. if it's a script that doesn't have to run all of the time, then i'd just make the function use a command line parameter, and set a logoff script in windows that calls the script with the parameter. that way if the script is called without the parameter or switch ('scriptname.exe /lo' for example) then it would execute normally, but if it is called with that parameter, the log out function runs instead... exampleif $CmdLine[0] then LogOutFunc() else NormalFunc() endif Link to comment Share on other sites More sharing options...
rmorrow Posted August 17, 2005 Share Posted August 17, 2005 Try using the OnAutoItExit function to execute some code only when your script is terminated. Something like: #NoTrayIcon While 1 Sleep(100) WEnd Func OnAutoItExit() If (@ExitMethod = 3) or (@ExitMethod = 4) Then; 3=Logoff 4=Shutdown ; Code to run before exit... EndIf EndFunc But beware that you have precious little time to do something before Windows asks the user to end this task. Hmmm... This might be nice as a service using the TCP functions for a sort of "hidden" machine status indicator. Have a server that listens for connecting machines and updates a (possibly web-based) list or a database, and actively marks them as "offline" when they shutdown or reboot... or even differentiate between logoff and shutdown events and tell the server that noone is logged on, or UserX is logged into the machine. My mind is racing on this one... Link to comment Share on other sites More sharing options...
Wanzler Posted August 18, 2005 Author Share Posted August 18, 2005 Thanks for your assistance! I've done it with the Management console from Windows2000 Link to comment Share on other sites More sharing options...
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