Turning off user specific PC access based on stimulus?

  • Thread starter Thread starter Brad Markisohn
  • Start date Start date
B

Brad Markisohn

Is there a way to log a non-administrative user off a PC or prevent them
from accessing the PC based on some external test? We can assume that the
OS is either Win 2k or Win XP.

TIA
Brad
 
Hi

I agree with Nikolay's suggestion.
Also to logoff the current user, we can use the ExitWindowsEx API, if you
wants to logoff another user, e.g. you have the admin right on an terminal
server., we can use the WTSLogoffSession API.

If you wants to prevent certain user from logon, I think it would be better
to disable his account even delete the account.

If you still have any concern please feel free to post here.


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Peter and Nikolay,

Thank you for the responses, however I don't think that I've explained my
problem very clearly. What I'd like to do is programatically log off or
disable a user based on some critieria. Here's an example of what I'd like
to do: My son's bed time is 10:00 PM. At 10:00 PM he should log off of the
computer and go to bed. I'd like to run an application, possibly a windows
service, that keeps track of time then logs him off when it's time to go to
bed. This doesn't have any other impact on the current user other than to
log them off. Is this something that I can do via the ExitWindows API?

Thanks again.

Brad
 
for this u can also use WTSLogoffSession API

it works on WIn XP
 
Hi

I agree with Nikolay's suggestion, because ExitWindowsEx API is used to log
off current user(The caller).

For detailed information, you may take a look at the MSDN.

The ExitWindowsEx function returns as soon as it has initiated the shutdown
process. The shutdown or logoff then proceeds asynchronously. The function
is designed to stop all processes in the caller's logon session. Therefore,
if you are not the interactive user, the function can succeed without
actually shutting down the computer.
ExitWindowsEx
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/bas
e/exitwindowsex.asp

Also here is link about WTSLogoffSession in vb6, I think it will be
migrated to vb.net easier.
BTW: Long in vb6 means 32bit while in vb.net long means 64bit. So in the
vb.net you can use int32 to replace the long in vb6.

Monolithic TS API Wrapper
http://dev.remotenetworktechnology.com/api/wtsapi.htm

If you still have any concern, please feel free to post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

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

Back
Top