?
Solved

Logoff Disconnected Users

Posted on 2009-12-25
3
Medium Priority
?
910 Views
Last Modified: 2012-05-08
i have a windows server 2003 with sp2
we using that by terminal server..
so users connect this server via remote desktop connection
i did automatically logoff if idle time is 15 minutes..
but i want to log off disconnected users via script (like vbs)
so what can i do ?
thnx and regards...
0
Comment
Question by:asyab
3 Comments
 
LVL 11

Expert Comment

by:Venugopal N
ID: 26122749
0
 
LVL 85

Accepted Solution

by:
oBdA earned 2000 total points
ID: 26123173
Save the script below as LogoffDisconnected.cmd or Whatever.cmd.
It's in test mode and will only display the "logoff" command(s) it would otherwise run. Simply remove the capitalized ECHO (so that line reads 'set test=') to run it for real.

@echo off
setlocal
set Server=%ComputerName%
REM set 'test' to an empty string instead of ECHO to run it for real:
set test=ECHO
for /f "tokens=1*" %%a in ('query session /server:"%Server%" ^| find /i "disc"') do (
  %test% logoff /server:"%Server%" "%%a" /v
)

Open in new window

0
 
LVL 1

Author Closing Comment

by:asyab
ID: 31669949
thnx
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question