Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Somebody could provide me a tip on how could I make a script file (.cmd) which logs off the current user AND all other open sessions with same username?

E.g.: I'm logged into three TS sessions with username "JOHN". I wish to run a script (from my current session, without administrative privileges) which would logoff my current session and also the other two.

Ideas?

share|improve this question

3 Answers 3

Just type logoff /? in your command prompt for the syntax. Than you can at least loff of your current session.

I think you need to have local admin permissions to log someone else off. Not sure how it is for another session from you. You can try if the task manager is enough for you (just hit CTRL+ALT+End and you get the Ctrl+ALT+DEL menu for your remote system; choose Task Manager). The task manager has a users tab that you can use to kick users out. It definitely works if you are a local admin. Be careful you can also kick your current session. ;)

share|improve this answer
    
Thanks! But unfortunately, this would logoff only the CURRENT session. Not the other two. BTW: It should not require administrative privileges simply because it is not someone else. It's me. Same credentials. –  Junior Dec 23 '09 at 19:45
    
Logoff also takes a session ID. or session name. So you should be able to kick other people off. With task manager you can kick off everyone (if you are an admin). –  Peter Schuetze Dec 23 '09 at 19:51

You should read this page. It has the full command line syntax for Terminal services

http://technet.microsoft.com/en-us/library/cc775998%28WS.10%29.aspx

share|improve this answer

Download TSLogoff from http://www.ctrl-alt-del.com.au/CAD_Utils.htm and run

tslogoff username /server:*

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.