[THIN] Re: Powershell for Self Service User Logoff of all XenApp 6.5 sessions

  • From: James Scanlon <scanjam@xxxxxxxxxxx>
  • To: <thin@xxxxxxxxxxxxx>
  • Date: Mon, 22 Sep 2014 18:02:37 +1000

Thank you!!!

> From: sraffens@xxxxxxxxxxx
> To: thin@xxxxxxxxxxxxx
> Subject: [THIN] Re: Powershell for Self Service User Logoff of all XenApp 6.5 
> sessions
> Date: Fri, 19 Sep 2014 16:33:11 +0000
> 
> You can variablize the user name like this:
> Get-XASession -Farm | Where-Object {$._AccountName -match 
> [Environment]::UserName} | Stop-XASession
> 
> 
> 
> 
> Steve Raffensberger
> Citrix Administrator
> Produban US
> sraffens@xxxxxxxxxxx
> 
> -----Original Message-----
> From: thin-bounce@xxxxxxxxxxxxx [mailto:thin-bounce@xxxxxxxxxxxxx] On Behalf 
> Of marcus
> Sent: Friday, September 19, 2014 12:20 PM
> To: thin@xxxxxxxxxxxxx
> Subject: [THIN] Re: Powershell for Self Service User Logoff of all XenApp 6.5 
> sessions
> 
> 
> 
> James Scanlon wrote:
> > Hey All,
> > I want to write a script that we can publish to the end user (a
> > published self service app??) that allows the end user to log themselves
> > and all their Citrix sessions off completely on our XA6.5 farm.
> >
> > Basically a click here to kill everything in Citrix if you cant access
> > something and its 2am and the service desk are not available.
> > There is lost of ideas out there, but was unable to find a 'whole of
> > farm' logoff - or indeed a program that says - "Hello user, you are
> > logged into servers X y Z, select the ones to stop and click next"....
> >
> > I am not much of a powershell scripter and after some searching and much
> > trial and error I have gotten this far with the script,
> > It seems to work sometimes, getting all the sessions for the user, other
> > times it gets none but Ibelieve its killing the session the script is
> > being run under so its then unable to get to the other sessions and
> > terminate them. I also still need to variablise the user name part too?
> >
> > Any one got any advice, ideas or tools that might help it would be
> > greatly appreciated. :)
> >
> > Add-Pssnapin Citrix*
> > Get-XASession -Farm | Where-Object { $_.AccountName -match
> > "Fred.Flintstone" } | stop-xasession
> Shure with powershell? How do you get around the per user startup time?
> 
> Around the beginning of june we had a similar topic in the list, topic
> was "session kill": //www.freelists.org/archive/thin/06-2014
> 
> I've modified the script a litte more to our customer and adminitrators
> needs, some logging and some more user feedback.
> 
> Delete \\ and linebreaks!
> 
> @echo off
> set  stampname=%date:~6,4%%date:~3,2%%date:~0,2%-%\\
> time:~0,2%%time:~3,2%%time:~6,2%_%username%
> set kicklogfile=\\store\share$\%stampname%.log
> set SRVLIST=\\store\share$\ctx-workers.lst
> @echo KICK %USERNAME% FROM:
> for /f %%i in (ctx6-workers.lst) do (
> @echo scanning Server %%i
> quser "%USERNAME%" /server:%%i 2>NUL | find /i "%USERNAME%" > \\
> %TEMP%\%%i.txt
> for /f "tokens=2" %%j in (%TEMP%\%%i.txt) do (
> @echo SERVER %%i >> %kicklogfile%
> qprocess "%username%" /Server:%%i >> %kicklogfile%
> @logoff %%j /server:%%i /V
> REM for /f "tokens=2" %%j in (%TEMP%\%%i.txt) \\
> do @echo %%j /server:%%i
> ))
> msg %USERNAME% /TIME:10 /W < %KICKLOGFILE%
> 
> 
> Configure \\store\share$ to your needs
> place your citrix servers into ctx-workers.lst, one per line
> 
> Publish the script from a server the users don't use for any other
> application, so the script is guaranteed to run in a clean session.
>  From my experience since june - the script is working fine in more than
> 90 %. The few where it hasn't worked as it should have done: not shure -
> 1st level support doesn't ask, the customers won't tell what they've
> done (aside of restarting local computers several times because of a
> published application has thrown an error.... )
> 
> hth, Marcus
> 
> 
> >
> >
> > Cheers
> > scanjam
> >
> 
> We recently changed our email addresses to reflect the Bank’s new name, 
> Santander. Please update your records accordingly.
> This message contains information which may be confidential and privileged. 
> Unless you are the addressee (or authorized to receive for the addressee), 
> you may not use, copy or disclose to anyone the message or any information 
> contained in the message. If you have received the message in error, please 
> advise the sender by reply e-mail, and delete or destroy the message. Thank 
> you.
> ________________________________
> 
> P Please consider the environment before printing this email
> 
> 
> h�
> ܆+ޱ���'���r��y+����m�+��C�����iƭ���׮��ay��� b�Hm�����祊�l��?�+-��b
                                          

Other related posts: