Page 1 of 1 1
Topic Options
#30407 - 2002-10-09 01:22 PM Disconnect users
kbarnett Offline
Fresh Scripter

Registered: 2001-11-09
Posts: 28
I am writing a script that will stop the logon service and disconnect all users from a remote NT Server. I can stop the service but I don't know how to kick everybody off. Can you help?
Top
#30408 - 2002-10-09 01:28 PM Re: Disconnect users
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
You could use a combination of rcmd [Reskit] and net sessions

hth

J.

(There must be a WMI/ADSI Way also)
_________________________



Top
#30409 - 2002-10-09 01:34 PM Re: Disconnect users
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
a bit quirky though :

1st step :

rcmd \\Server net sessions > logfile

2nd

Open Logfile , read line by line; find if first 2 chars are '\\', cut the machine name out of it
{edit} Make sure that you don't kick your own session [Big Grin] {/edit};
do rcmd \\Server net sessions \\MachineNameString /delete /y

[Eek!]

[ 09. October 2002, 13:46: Message edited by: jpols ]
_________________________



Top
#30410 - 2002-10-09 01:50 PM Re: Disconnect users
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
so, would shorter be:
get somewhere the time and add it with 1-2 mins. (don't want to write it as did already once today [Wink] )
with that time call at:
at \\server time kickoff.bat

bat would include:
net sessions /delete

that should do it. uttleast the doc says so.
_________________________
!

download KiXnet

Top
#30411 - 2002-10-09 01:52 PM Re: Disconnect users
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
And finally a link to a rcmd installer udf by Bryce :

link
_________________________



Top
#30412 - 2002-10-09 01:55 PM Re: Disconnect users
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
hehe ... didn't knew that and overlooked it [Roll Eyes]

consider to do it with rcmd anyway as it is simply good to have on remote servers [Smile]
_________________________



Top
#30413 - 2002-10-09 02:23 PM Re: Disconnect users
kbarnett Offline
Fresh Scripter

Registered: 2001-11-09
Posts: 28
Thanks Guys, I will try both sugestions!
Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1110 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.059 seconds in which 0.028 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org