≡ Menu

Powershell: Most useful powershell commands for XenApp environment

This is continuation to my previous post. I want to add more commands that System Administrator require to manage XenApp environment using powershell. Below are some of them. I will extend the list as and when I find something.

Get the list of Users currently using a published XenApp Application:

Get-XASession -BrowserName notepad | select AccountName

Get the computer(or client) name from where a XenApp Application is launched

Get-XASession -BrowerName notepad | select ClientName, AccountName

Logoff a user(user1) session who opened “MS Word” application in XenApp:

(Get-XASession -BrowserName “MS Word” -ServerName XenAPP1 | ? {$_.AccountName -match “User1” }).SessionID | Stop-XASession

Get all published XenApp applications on a Server

Get-XAApplication -ServerName XenApp1 | select DisplayName

Get all Desktops published in XenApp environment

Get-XAApplication | ? {$_.ApplicationType -eq “ServerDesktop” } | select DisplayName

Get the users or groups who has permission to a published application:

Get-XAAccount -BrowserName App1

How to get the list of processes running in a given XenApp session on server:

Get-XASessionProecss -ServerName XenApp1 -Sessionid 10

 Rename a published XenApp Application (or change displayname of XenApp Application):

Get-XAApplication -BrowserName “My Notepad” | Rename-XAApplication -NewDisplayName “My Notepad – OLD”

Change the description of a XenApp application:

Get-XAApplication -BrowserName “My Notepad – OLD” | Set-XAApplication -Description “This is going to retire”

 

Comments on this entry are closed.

  • David Griffiths July 17, 2013, 6:33 pm

    Get the list of Users currently using a published XenApp Application:
    Can this be modified to list all applications ?

    I am trying to produce report of all applications with user count

    $notepad = – Get-XASession -BrowserName notepad | select AccountName
    $notepad.count

  • viswanath May 29, 2014, 7:24 pm

    Hi,
    could you provide a powershell script for deleting local profiles on the XenApp servers and the script should be in the following process.
    1) verify and display the sessions of a particular user mentioned tn the powershell
    2)Prompt to logoff the single session in a group of sessions of that user by YES or NO option
    3)delete the local profile on the server that the application (session in step 2) is hosted .
    4)Rename the profile in the Shared location.

    • Sitaram Pamarthi May 29, 2014, 7:58 pm

      @Viswanath, you can make use of the code available in my blog. I don’t write custom scripts for individual needs.

  • Scott July 18, 2014, 8:28 pm

    Logoff a user(user1) session who opened “MS Word” application in XenApp:

    (Get-XASession -BrowserName “MS Word” -ServerName XenAPP1 | ? {$_.AccountName -match “User1″ }).SessionID | Stop-XASession

    This does not work for me (XenApp 6.5). When I run this it will log off ALL of the users sessions/applications not just the one I want. For example:

    user AD\John.Doe has Word, Notpad and 3rdPty app open.
    I run this command to close Word. It will close ALL apps. Is there an update or something I am missing to running this?

  • Sahil Aaron September 20, 2016, 6:13 pm

    Hi,

    I want to check who is the last user connected to an application and when in the last three months. Please provide me the powershell script.

    Regards
    Sahil