Page 1 of 1 1
Topic Options
#129220 - 2004-11-10 11:41 AM automate logoff of all users from a server
ankit Offline
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
#129221 - 2004-11-10 11:59 AM Re: automate logoff of all users from a server
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
could I ask what is the reason for this?
there are some ways to go with it.
the easiest would be to restart server service, for example...
_________________________
!

download KiXnet

Top
#129222 - 2004-11-10 12:17 PM Re: automate logoff of all users from a server
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
hmmm ... restarting the Server Service will not keep the users away from the Server, at least not for long.

ankit, you talk about logging off / free ressources on Servers for some tasks running overnight, do you ??
_________________________



Top
#129223 - 2004-11-10 12:24 PM Re: automate logoff of all users from a server
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ja, but that's why I asked what he wants.
there are darn many ways to do it, depending on the usage/purpose.
_________________________
!

download KiXnet

Top
#129224 - 2004-11-10 07:00 PM Re: automate logoff of all users from a server
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
In short NO

You can not LOG OFF a user from a single server. If you log them off, you log them off from all network resources on all servers and locally as well.

You can though prevent access to certain resources on a single server. As the others have mentioned, you need to be more clear on what it really is that you want to achieve here.

Top
#129225 - 2004-11-10 11:28 PM Re: automate logoff of all users from a server
ShaneEP Moderator Offline
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
#129226 - 2004-11-10 11:52 PM Re: automate logoff of all users from a server
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, as far as I see it, you log on to server when you first contact to it.
no matter are you on domain logged on or not, your wksta goes for the security pipes on that server.
and I see it as logging off is same as closing that security pipe and trashing all current sessions.

but again, TS logging off is another level stuff and as said by citrixdude, that's also something that needs clarification too.
_________________________
!

download KiXnet

Top
#129227 - 2004-11-11 10:56 AM Re: automate logoff of all users from a server
ankit Offline
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
#129228 - 2004-11-11 11:40 AM Re: automate logoff of all users from a server
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
Is that a setting within terminal services? to do that? i belive the setting is within terminal services manager
_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
#129229 - 2004-11-11 11:49 AM Re: automate logoff of all users from a server
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
Check out this link for info on commands for terminal services

Terminal Services Commands
_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
#129230 - 2004-11-11 08:09 PM Re: automate logoff of all users from a server
NTDOC Administrator Offline
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
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 976 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.063 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