Win XP: Log users on/off

  • Thread starter Thread starter Lew Barnesson
  • Start date Start date
L

Lew Barnesson

I need to write code which can determine what users are logged on, and which
can log users off. Can anyone steer me to such a Namespace/API's? Thanks.

- Lew
 
Hello Lew,

LB> I need to write code which can determine what users are logged on,

Systen.Environment.UserName

LB> and which can log users off.

What does it mean?

---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
Michael,
Thanks for responding. What does it mean? (Re: parental supervision) I need
to be able to log off a specific user. - Lew
 
Hello lewb,

Use WTSLogoffSession with the user's session ID

http://msdn.microsoft.com/library/d...v/termserv/wtsregistersessionnotification.asp
sample is there http://www.pinvoke.net/default.aspx/wtsapi32/WTSLogoffSession.html


l> Michael,
l> Thanks for responding. What does it mean? (Re: parental supervision)
l> I need
l> to be able to log off a specific user. - Lew
l> l>---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
Michael,
Thanks again! Although I still do not have a way to enumerate ALL logged-on
users. :-) - Lew
 
Oh Oh! I spoke too soon -- I need the Enumeration() and Logoff()
capabilities to work with users logging on locally to a standalone PC
running XP (not a server). Doesn't seem as though the WTS... functions would
work in that environment. :-(

Any other thoughts on this? Thanks. - Lew
 
Hello lewb,

Then use ExitWindows() API function http://www.pinvoke.net/search.aspx?search=ExitWindows&namespace=[All]

l> Oh Oh! I spoke too soon -- I need the Enumeration() and Logoff()
l> capabilities to work with users logging on locally to a standalone PC
l> running XP (not a server). Doesn't seem as though the WTS...
l> functions would work in that environment. :-(
l>
l> Any other thoughts on this? Thanks. - Lew
l>
l> l>---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsch
 
Sure it does, it's the only environment in which you can have two (Windows
XP) users logged on simultaniously. But honestly I fail to see why you want
this on a workstation, interactve user sessions should log off manually
don't they?


Willy.

|
| Oh Oh! I spoke too soon -- I need the Enumeration() and Logoff()
| capabilities to work with users logging on locally to a standalone PC
| running XP (not a server). Doesn't seem as though the WTS... functions
would
| work in that environment. :-(
|
| Any other thoughts on this? Thanks. - Lew
|
|
| | > Hello lewb,
| >
| > Use WTSLogoffSession with the user's session ID
| >
| >
http://msdn.microsoft.com/library/d...v/termserv/wtsregistersessionnotification.asp
| > sample is there
| > http://www.pinvoke.net/default.aspx/wtsapi32/WTSLogoffSession.html
| >
| >
| > l> Michael,
| > l> Thanks for responding. What does it mean? (Re: parental supervision)
| > l> I need
| > l> to be able to log off a specific user. - Lew
| > l> | > l>
| >>> Hello Lew,
| >>>
| >>> LB> I need to write code which can determine what users are logged
| >>> on,
| >>>
| >>> Systen.Environment.UserName
| >>>
| >>> LB> and which can log users off.
| >>> What does it mean?
| >>> ---
| >>> WBR,
| >>> Michael Nemtsev :: blog: http://spaces.live.com/laflour
| >>> "At times one remains faithful to a cause only because its opponents
| >>> do not cease to be insipid." (c) Friedrich Nietzsche
| >>>
| > ---
| > WBR,
| > Michael Nemtsev :: blog: http://spaces.live.com/laflour
| >
| > "At times one remains faithful to a cause only because its opponents do
| > not cease to be insipid." (c) Friedrich Nietzsche
| >
| >
|
|
 
Willy,

Not in this case.

This is for parental supervision purposes (as mentioned in my original post)
in an environment where only one person will be using the PC/logged-on at a
time (and I did mention in my original post a non-server environment which
would be accessed locally, as opposed to remote access).

Thanks anyway. - Lew
 
Michael,

Thanks; I'll check it out. - Lew


Michael Nemtsev said:
Hello lewb,

Then use ExitWindows() API function
http://www.pinvoke.net/search.aspx?search=ExitWindows&namespace=[All]

l> Oh Oh! I spoke too soon -- I need the Enumeration() and Logoff()
l> capabilities to work with users logging on locally to a standalone PC
l> running XP (not a server). Doesn't seem as though the WTS...
l> functions would work in that environment. :-(
l> l> Any other thoughts on this? Thanks. - Lew
l> l>---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do
not cease to be insipid." (c) Friedrich Nietzsche
 
This will give the list of local users;
NetUserEnum


If you want the list of loged on users then use:
NetWkstaUserEnum;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Logging off 5
reading win 7 event logs 1
IPad Multiple Users 0
How read from Active Directory? 5
Dotnet 4 - Writing to event log 2
Event Log User 1
Amazon Login Location Different 4
Windows Hello devices 13

Back
Top