#129220 - 2004-11-10 11:41 AM
automate logoff of all users from a server
|
ankit
Lurker
Registered: 2004-11-10
Posts: 2
|
I am very new to kix, know almost nothing abt it. I need to write a script that will automatically logoff all users logged into a Win 2000 server. Kindly help, any suggestions would be greatly helpful, Thanks...Ankit
|
|
Top
|
|
|
|
#129225 - 2004-11-10 11:28 PM
Re: automate logoff of all users from a server
|
ShaneEP
MM club member
   
Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
|
Well that depends on if the server is running terminal services or not. I believe you can log users off of a server if its TS.
Quote:
D:\>logoff /? Terminates a session.
LOGOFF [sessionname | sessionid] [/SERVER:servername] [/V]
sessionname The name of the session. sessionid The ID of the session. /SERVER:servername Specifies the Terminal server containing the user session to log off (default is current). /V Displays information about the actions performed.
Didnt see the poster mention anything except Windows 2000 Server however.
|
|
Top
|
|
|
|
#129227 - 2004-11-11 10:56 AM
Re: automate logoff of all users from a server
|
ankit
Lurker
Registered: 2004-11-10
Posts: 2
|
I wanted to logoff the users from the server who have logged in using terminal services, sorry for not mentioning this earlier...Ankit
|
|
Top
|
|
|
|
#129230 - 2004-11-11 08:09 PM
Re: automate logoff of all users from a server
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11634
Loc: Space
|
Not sure if this will do what you're wanting to do or not, but you can modify which settings you want to modify on your Terminal Servers using this as a remote Admin Script. Code:
Break On Dim $SO,$System,$Systems $SO=SetOption('Explicit','On') $SO=SetOption('NoVarsInStrings','On') $Systems = 'TSERVER01','TSERVER02','TSERVER03','TSERVER04' For each $System in $Systems ResetTerminalServerSettings($System) Next Function ResetTerminalServerSettings(optional $System) Dim $Key,$SetfInheritResetBroken,$SetfInheritMaxSessionTime,$SetfInheritMaxDisconnectionTime, $SetfInheritMaxIdleTime,$SetfResetBroken,$SetMaxDisconnectionTime,$SetMaxIdleTime, $SetMaxConnectionTime,$Remote $Remote = Join(Split($System, '\'), '', 3) $Remote = IIf($Remote <> '', '\\' + $Remote + '\', $Remote) $Key = 'HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' $SetfInheritResetBroken = WriteValue($Remote + $Key,'fInheritResetBroken',0,'REG_DWORD') $SetfInheritMaxSessionTime = WriteValue($Remote + $Key,'fInheritMaxSessionTime',0,'REG_DWORD') $SetfInheritMaxDisconnectionTime = WriteValue($Remote + $Key,'fInheritMaxDisconnectionTime',0,'REG_DWORD') $SetfInheritMaxIdleTime = WriteValue($Remote + $Key,'fInheritMaxIdleTime',0,'REG_DWORD') $SetfResetBroken = WriteValue($Remote + $Key,'fResetBroken',1,'REG_DWORD') $SetMaxConnectionTime = WriteValue($Remote + $Key,'MaxConnectionTime',0,'REG_DWORD') $SetMaxDisconnectionTime = WriteValue($Remote + $Key,'MaxDisconnectionTime',60000,'REG_DWORD') $SetMaxIdleTime = WriteValue($Remote + $Key,'MaxIdleTime',1800000,'REG_DWORD') EndFunction
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1171 anonymous users online.
|
|
|