mattw112 Posted February 13, 2009 Share Posted February 13, 2009 (edited) I know a million ways to initiate a logoff from the currently logged on user (shutdown(), shutdown.exe, dll's, etc...), but how would I logoff another user on the same system? I need to uninstall software but I need to make sure no other users are logged onto the system. When there is another user I need to log them off then uninstall my software. Any ideas? Manually it is easy too. I can open task manager, go to the Users tab and select the user and right click and say logoff. I'd rather not do a bunch of sendkeys though if I can send a command line. Thanks, Terry Edited February 13, 2009 by mattw112 Link to comment Share on other sites More sharing options...
herewasplato Posted February 13, 2009 Share Posted February 13, 2009 Probably best to restart the computer before that install anyway. [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Manjish Posted February 13, 2009 Share Posted February 13, 2009 Use tsdiscon.exe..tdiscon.exe from the microsoft website:Tsdiscon disconnects a session from a terminal server. You must have Full Control permission to disconnect another user from a session.If no session ID or session name is specified, tsdiscon disconnects the current session. The console session cannot be disconnected.refer to this. [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com Link to comment Share on other sites More sharing options...
rudi Posted February 13, 2009 Share Posted February 13, 2009 Hi. rem Alle TS Sitzungen schliessen (close all TS sessions) For /f "tokens=3" %%i in ('QWinSta ^| Find /i "aktiv" ^| find /i "rdpwd"') Do Echo y | RWinSta %%i to close disconnected sessions, change "aktiv" (active) to whatever string represents disconnected sessions in you Window's language. Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
mattw112 Posted February 17, 2009 Author Share Posted February 17, 2009 Thanks, So I tried the TSDiscon... It only disconnects the session it doesn't log off the user from the session. But the query tool does let me know if that other user is logged on or not, which may be helpful. Microsoft should just make it a command line feature of shutdown.exe. Using that tool you can do a logoff of the current session, would be easy to add a switch to specify the user session to log off? Anyone else have any ideas on logging off other user sessions. Also this isn't related to terminal services or remote desktop or anything. I just have a bunch of systems which may have multiple users logged on to them. Thanks, Terry Link to comment Share on other sites More sharing options...
rudi Posted February 21, 2009 Share Posted February 21, 2009 Thanks,So I tried the TSDiscon...My example didn't use tsdiscon , see below:For /f "tokens=3" %%i in ('QWinSta ^| Find /i "aktiv" ^| find /i "rdpwd"') Do Echo y | RWinSta %%iAlso this isn't related to terminal services or remote desktop or anything. I just have a bunch of systems which may have multiple users logged on to them.I use it with Win XP SP2 and 3. IIRC it's also fine for local sessions, pls check on your PCs, I never ever have multiple users logged into one workstatation.Step by step:QWinStawhat to search for (Find /i "aktiv")optional: what to search for again, to narrow the results (find /i "rdpwd")then the statement in red.As another chance have a look at the options of shutdown() (autoit and windows)Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now