Sign in to follow this  
Followers 0
Wanzler

Start Script when User logoffs

4 posts in this topic

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 ?

Share this post


Link to post
Share on other sites



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

if $CmdLine[0] then 
LogOutFunc()
else
NormalFunc()
endif

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

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.

:whistle: 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... :dance:

Share this post


Link to post
Share on other sites

Thanks for your assistance! I've done it with the Management console from Windows2000

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0