Page 1 of 1 1
Topic Options
#134258 - 2005-02-22 02:28 AM Detecting a log off
Bjoern Offline
Fresh Scripter

Registered: 2005-02-20
Posts: 9
Hi guys !
I got such a good responce the last time I posted something here, that I might as well try again...

I have a script that is running hidden while the user is logged in. Now, this works perfect, but of course, on a WinXP/2k machine, if you log off and have any programs running, the "End program" dialogbox pops up...

Are there any way, either by using a built-in kix-fuction, COM-automated "thing", external programs or anything else to detect when the user logs off/shuts down ?

Top
#134259 - 2005-02-22 02:58 AM Re: Detecting a log off
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Why does it run in user's memory space? Why not run it as a scheduled task or service?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#134260 - 2005-02-22 03:05 AM Re: Detecting a log off
Bjoern Offline
Fresh Scripter

Registered: 2005-02-20
Posts: 9
Well... It starts as a logonscript, but instead of quitting, it hides, to be in the background and detect user actions, log data, and perform operations decided by the sysadmin.

The mian purpose is to change the number in my logfile, which shows "Computers currently in use". When the person logs off or shuts down, it changes by number by -1.

Any solutions ??

Top
#134261 - 2005-02-22 03:08 AM Re: Detecting a log off
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Use a logoff script instead to decrease the counter. Howeve, the better method would be to check the DCs event logs to determine how many times a particular user is logged on. Or have the user connect to a hidden shre that only allows one copnnection, as soon as a second connectiong is being established, kick the user off.
_________________________
There are two types of vessels, submarines and targets.

Top
#134262 - 2005-02-22 03:34 AM Re: Detecting a log off
Bjoern Offline
Fresh Scripter

Registered: 2005-02-20
Posts: 9
Uhm... Let me clarify the point a little bit...

It's not just the counter that is important, but the whole thing with the Kix running in the background to perform several other operations too, based on user actions.

Once again; Does anyone have a solution on how to detect when the user logs off/shuts down ? I need the kixscript that is already running to perform an operation when the user logs off/shuts down.

I'll probably go with the logoff-script if I can't find any better way, even though it's not a very good solution in my case...

Top
#134263 - 2005-02-22 03:36 AM Re: Detecting a log off
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
If you woudl explain in more detail what these "other" actions are we could assist you better.
_________________________
There are two types of vessels, submarines and targets.

Top
#134264 - 2005-02-22 05:11 AM Re: Detecting a log off
Bjoern Offline
Fresh Scripter

Registered: 2005-02-20
Posts: 9
Heh... I sounded slightly short in the last reply there... Sorry... Didn't quite mean to make it sound like I'm angry...

Well... The whole application is two things... A logon script, and a control panel for the master computer where I am. The control panel perform operations like kick off user, send/receive messages, read computer status (in use or not), run apps and more snacks like that (I'll explain further if needed).

The way I have done this (it might be a long way around, but at least it's my way) is to save information from the master computer, to a global INI-file, found in the NETLOGON-folder. When the KIX-application running hidden on the workstation detects a variable change in the proper place of the INI-file, it runs the desired action, like kick off (even though I easily could have done this with ShutDown()) and also the functions mentioned above, like send/receive messages.

I know there's a lot of programs like this already out there, but I'm just making one to get better in Kix and programming...

I just need a way to figure out how to detect when the user logs off or shuts down the computer. All suggestions are taken with a great THANK YOU in a desperate moment (like this!)

Top
#134265 - 2005-02-22 07:47 AM Re: Detecting a log off
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
You could run a remote admin script that keeps checking the computer every 5 minutes or what ever time you set that checks who is logged on. If you detect the computer is down, the do what ever you're wanting to do when you find it down, or if you find the user is no longer logged on, do what you want to do remotely.
Top
#134266 - 2005-02-22 08:30 AM Re: Detecting a log off
Bjoern Offline
Fresh Scripter

Registered: 2005-02-20
Posts: 9
Yeah, that's a good solution too, but not really what I'm asking for...

I hate being this picky
Thanks anyways though

Top
#134267 - 2005-02-22 08:52 AM Re: Detecting a log off
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Well the only other thing I can think of is trying the srvany utility to load kixtart as a service, otherwise you will always be prompted that KiXtart is running because it is.

Top
#134268 - 2005-02-22 10:28 AM Re: Detecting a log off
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
You could try adding...

Code:
$null = WriteValue("HKCU\Control Panel\Desktop","AutoEndTasks","1",REG_SZ)



to the beginning of your login script. This doesnt help with the 'detecting logoff' problem, but i believe it should get rid of the prompt asking to end the process.

Top
#134269 - 2005-02-22 04:46 PM Re: Detecting a log off
Bjoern Offline
Fresh Scripter

Registered: 2005-02-20
Posts: 9
Hey, thanks ! I'll add that to my script, because that gets rid of the "End Application" problem.
The service-solution works too !! Thanks, guys

Still having that detecting problem, though...

Top
#134270 - 2005-02-23 12:19 AM Re: Detecting a log off
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
The problem with the service solution might be interaction with the user. However, why this Big Brother approach? Is this some kind of Internet cafe?

Another solution would be to implement a KiXforms script using the new sockets functionality and waiting for input from the master computer to activiate specific tasks. Should be less taxing, can use a tray icon, and generally a funky project to e.g. develop the data exchange protocol.
_________________________
There are two types of vessels, submarines and targets.

Top
#134271 - 2005-02-24 10:38 PM Re: Detecting a log off
Bjoern Offline
Fresh Scripter

Registered: 2005-02-20
Posts: 9
Sounds cool with that KixForms idea ! I'll look into that!
It's a school... And beleive me... In this school we need it!

Top
Page 1 of 1 1


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1636 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.087 seconds in which 0.043 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org