Archived from groups: microsoft.public.windowsnt.terminalserver.client (
More info?)
Or you can try this, save the following in a cmd file:
REM reset all session
for /f "tokens=3" %%i in ('qwinsta /server:%1 ^| findstr /bc:" console"') do
rwinsta /server:%1 %%i
The cmd file will take your remote servername as input. i.e. if you want to
reset/logoff all sessions (except console) on server MyServer, then schedule
to run it as:
My.cmd MyServer
The above command should not require you to have run change logon/enable.
thanks
Soo Kuan
--
This posting is provided "AS IS" with no warranties, and confers no rights
"Vera Noest [MVP]" <vera.noest@remove-this.hem.utfors.se> wrote in message
news:Xns951E88B07605veranoesthemutforsse@207.46.248.16...
> Yes, you can schedule a job that uses the "rwinsta" command. Be
> sure to use "change logon /disable" first, otherwise they will be
> able to reconnect immediately.
> After your backup is finished, use "change logon /enable" to let
> them in again.
> There are some obvious risks involved in doing so: if you execute
> the last command (change logon /enable) from within your backup
> software, then it won't ever execute if your backup hangs (because
> no tape is available or whatever). That means that nobody will be
> able to login, until you enable logons again from the console (YOU
> won't be able to logon either, through rdp). So think it through
> before you implement this!
>
> Matthew Harris has posted a command file that does this, in
> microsoft.public.win2000.termserv.apps, around the end of april
> last year.
>
> Since that discussion used a great number of different threads
> with different subjects, I won't give you the links, but a
> synopsis. You can search for all articles in Google, use
> "rwinsta" as the keyword and "Matthew Harris" as the Author.
>
> The command from the console is:
> for /f "tokens=2" %i in ('qwinsta ^| find /i "listen"') do
> echo y | rwinsta %i
>
> Be sure to substitute a %%i whereever you see %i appear in the
> command, if you run it from a batchfile.
>
> Matthews explanation:
> The command is relatively simple, although the way I
> constructed it makes it appear quite complex. First of
> all, the For command runs the QWinsta command, which shows
> all current sessions and listeners on your terminal
> server. The output of the QWinsta command is then
> searched, using the Find command, for the word "listen".
> The word "listen" designates which sessions on your
> terminal servers are the listeners, and consequently, if
> you reset a listener, all sessions running under that
> listener will be reset (thus, if all your sessions are rdp-
> tcp, and you reset the rdp-tcp listener, all your sessions
> will be reset). The For command then takes the output of
> the Find command and looks at the second argument. This
> argument is the session number of the listener. The For
> command takes the argument and gives it to the RWinsta
> command, which will then reset that session (the
> listener). The Echo Y command merely says "yes" to
> RWinsta asking if you are sure you know what you are doing
> (and we do!)
>
> --
> Vera Noest
> MCSE, CCEA, Microsoft MVP - Terminal Server
>
http://hem.fyristorg.com/vera/IT
> --- please respond in newsgroup, NOT by private email ---
>
> <anonymous@discussions.microsoft.com> wrote in news:26c2b01c462de
> $3b087bd0$a501280a@phx.gbl:
>
> > Thanx for responding. Yes , even with all the risks
> > involved, I would like to Log off all sessions at a given
> > time. Is this possible?
> >
> >>-----Original Message-----
> >>If you simply disconnect ts sessions, application runs
> > in the ts sessions
> >>are still running, and potentially locking/opening some
> > files. Do you mean
> >>you want to logoff ts sessions?
> >>loging off ts sessions remotely is highly risky, as all
> > unsaved work within
> >>each session will be gone.
> >>Do you really want to do this?
> >>
> >>
> >>
> >>--
> >>This posting is provided "AS IS" with no warranties, and
> > confers no rights
> >>
> >>
> >>"Joseph" <anonymous@discussions.microsoft.com> wrote in
> > message
> >>news:23bdd01c45eb2$f724f300$a501280a@phx.gbl...
> >>> We run a backup at a specified time each night . The
> >>> problem is we use terminal server alot and many users
> >>> disconnect while they have applications running and
> > since
> >>> the files are open, the backup does not operate
> > properly.
> >>> Is there any way to have all sessions disconnect
> >>> automatically at a given time say two minutes before
> > the
> >>> backup is scheduled to start. I noticed idle session
> > limit
> >>> settings can be configured for a time interval
> > however, I
> >>> havent found a way to specify an exact time for logoff.