| | |
Disonnect remote users via Script on Terminal Services
![]() |
•
•
Join Date: Nov 2005
Posts: 134
Reputation:
Solved Threads: 10
Hi all,
My client is running a Win 2003 SP1 Server with many users accessing it through Terminal Services. Every night I have some scripts to run that only run correctly if all users are logged off from Terminal Services.
I am wondering if it is possible to script the logoff of all remote users in Terminal Services? If so, could someone please point me in the right direction for doing this.
I didn't see anything in the previous posts about this but maybe I missed.
Thanks for your attention
Yomet
My client is running a Win 2003 SP1 Server with many users accessing it through Terminal Services. Every night I have some scripts to run that only run correctly if all users are logged off from Terminal Services.
I am wondering if it is possible to script the logoff of all remote users in Terminal Services? If so, could someone please point me in the right direction for doing this.
I didn't see anything in the previous posts about this but maybe I missed.
Thanks for your attention
Yomet
•
•
Join Date: Nov 2005
Posts: 134
Reputation:
Solved Threads: 10
Hi all,
I found the answer, after correctly rephrasing my Google search... :o
query session >session.txt
for /f "skip=2 tokens=3," %%i in (session.txt) DO logoff %%i
del session.txt
Found at this URL:
http://winfaq.msterminalservices.org...=2&sortby=date
Sorry for wasting your time
Yomet
I found the answer, after correctly rephrasing my Google search... :o
query session >session.txt
for /f "skip=2 tokens=3," %%i in (session.txt) DO logoff %%i
del session.txt
Found at this URL:
http://winfaq.msterminalservices.org...=2&sortby=date
Sorry for wasting your time
Yomet
I would also turn on the messenger service on the servers so I could script/schedule a broadcast a message to at least inform other admins that their session is going away. if you don't you're risking alarming your fellow admins unnecessarily. you could script with sc to enable/disable & start/stop messenger if you don't like having it run all the time. I would also use the same technique to shut down the TS service while running the scripts so nobody can login and interfere with your scripting requirements.
it's hard to find info about this because of the nature of console logins...this would only be admin users and thus normally you would never want to be kicking that kind of user out. obviously, you want your script to run, but something about blowing away admin sessions just doesn't sit right with me. i would at least let everyone know before i did that and also script in indicators so admins don't try to "fix" a problem which is really just your scripts doing their thing. for the console thing, to me, it makes more sense to request other admins not to leave stale console sessions, you know, use remote desktop only and broadcast a message to TS users five minutes before the force logoff of TS users runs.
another idea for the console thing, depending on number of servers you're running the script on, would be to use mstsc to log into the console session and check to make sure there's nobody logged in on the console before the script runs...this kinda defeats the point automating the tasks through scripting, though, since you'd have to login manually to do this.
mstsc /v <server: port> /console
it's hard to find info about this because of the nature of console logins...this would only be admin users and thus normally you would never want to be kicking that kind of user out. obviously, you want your script to run, but something about blowing away admin sessions just doesn't sit right with me. i would at least let everyone know before i did that and also script in indicators so admins don't try to "fix" a problem which is really just your scripts doing their thing. for the console thing, to me, it makes more sense to request other admins not to leave stale console sessions, you know, use remote desktop only and broadcast a message to TS users five minutes before the force logoff of TS users runs.
another idea for the console thing, depending on number of servers you're running the script on, would be to use mstsc to log into the console session and check to make sure there's nobody logged in on the console before the script runs...this kinda defeats the point automating the tasks through scripting, though, since you'd have to login manually to do this.
mstsc /v <server: port> /console
![]() |
Similar Threads
- Network Adapter Disconnections due to terminal services (Networking Hardware Configuration)
- Citrix vs Terminal Services (Windows NT / 2000 / XP)
- Logging on through Terminal Services (Windows NT / 2000 / XP)
Other Threads in the Windows NT / 2000 / XP Forum
- Previous Thread: Cant read IO.SYS
- Next Thread: lost my documents folder
| Thread Tools | Search this Thread |
.net 64bit 2007 2010 a.exe activedirectory address android apache application appstore automatically black blue bsod bulletin canonical chinese codeplex combofix cursor deployment deployments desktop dns domain drive eartlink error explorer fax fontmanagers fonts format framework freeze hardware home interoperability laptop laptops lcd linux login mac markshuttleworth memory microsoft minimalizes monitor motionle1600 netbooks novell nvidia open opensource operatingsystems options oracle osinstallationproblem osx outlook palm printer program proxy raid reformat remotedesktop repair replacingraiddrive retail retrieve screen security server. sharepoint simplifiedchinese sitetositevpn slowperformance sp3 spyware studios technology ubuntu update upgrade videodrivers virus vista visual vpn win win32/heur windows windows7 windowsxp windowsxpnotstartingup. xp xpde





