Need help killing active TS sessions

(imported topic written by nberger91)

Hi

Does anyone have a script, WMI or command line that can kill ALL active TS sessions without having to explicitely specify the session ID # ?

Currently we use the following script prior to the BigFix restart 30 command which is not effective on Citrix servers. - (restart initiates but active RDP connections prevent successful execution)

dos echo y | cmd /c For /f “tokens=3” %i in (‘QWinsta’) do logoff %i

dos echo y | cmd /c For /f “tokens=2” %i in (‘QWinsta’) do logoff %i

dos echo y | cmd /c For /f “tokens=3” %i in (‘QWinsta’) do tsdiscon %i

dos echo y | cmd /c For /f “tokens=2” %i in (‘QWinsta’) do tsdiscon %i

dos echo y | cmd /c For /f “tokens=3” %i in (‘QWinsta’) do rwinsta %i

dos echo y | cmd /c For /f “tokens=2” %i in (‘QWinsta’) do rwinsta %i

Any help appreciated.

Thanks

(imported comment written by brolly3391)

Hi nberger,

I am not sure if it will fulfill your needs but try TSSHUTDN?

http://support.microsoft.com/?kbid=320188

Nice scripting by the way.

Cheers,

Brolly

(imported comment written by nberger91)

Hi Brolly, thanks for the advice

I’m testing the following action script which works however i need to use the ‘restart’ command aswell because the tsshutdn command doesnt exist on Windows 2000 workstation. -

dos cmd /c tsshutdn 60 /reboot

restart 1

Is there anyway, using BES 5.1, I can script (within the action script) - If WinxXP, 2003, or 2000 Svr then ‘TSSHUTDN’ elseif Windows 2000 ‘restart 1’

I think you guys call it elseif…

Thanks

(imported comment written by BenKus)

Hey Nberger,

In BES 6.0, the clients would support the following:

IF {name of operating system = “Win2000”}

restart 60

ELSE

dos cmd /c tsshutdn 60 /reboot

ENDIF

Unfortunately, BES 5.1 Clients don’t support that action syntax…

Maybe we can try this:

restart 300
continue if {name of operating system = “WinXP” OR name of operating system = “Win2003”}
dos cmd /c tsshutdn 60 /reboot

This might work… basically all computers will run “restart 300” and then only the xp/2003 computers will run the tsshutdn command (others will fail the “continue if” line).

Ben

(imported comment written by TommyG91)

I need to create a fixlet that identifies disconnected TS / cirtix sessions and logs them off and disconnects them. There will be GOOD sessions on the clients so I can’t disconnect everyone. I’ve scoured around the forum, but can’t find anything. Any ideas?

Thanks

Tom

(imported comment written by BenKus)

Hey Tom,

Here is some relevance to identify logged on users and their state:

q: (name of it, active of it) of logged on users
A: ben_kus, True

Or just inactive users:

q: names of logged on users whose (not active of it)