PowerShell is a powerful scripting language. You can accomplish quite a lot with a single, but sometimes long, line of code. Here are a couple of my personal favorite “one liners” for Citrix XenApp.
In order to run these commands simply open a PowerShell window, execute the command add-pssnapin citrix* (to load the Citrix plug-ins) and copy and execute the line of code.
List all published applications in the farm (including the client folder name)
1 |
(Get-XAApplication | Sort-Object ClientFolder,DisplayName) | Foreach-Object {If ($_.ClientFolder) {Write-Host ($_.ClientFolder + "\" + $_.DisplayName)} Else {Write-Host $_.DisplayName}} |
List all applications in the farm (display name only)
1 |
Get-XAApplication | Sort-Object DisplayName | Foreach-Object {Write-Host $_.DisplayName} |
Count all currently logged on users
Did you ever want to know how many unique users are currently logged on to your farm? Here is your chance:
1 |
((Get-XASession -farm).AccountName | Sort-Object –Unique).count |
List all currently logged on users
The following command line shows you which users are currently logged on to your farm.
1 |
(Get-XASession -farm).AccountName | Sort-Object |
Determine how many applications are published in more than two subfolders
Determine how many applications are published in more than two subfolders
1 |
(Get-XASession -farm).AccountName | Sort-Object(Get-XAApplication | Where-Object { ((($_.ClientFolder).split("\").count) -gt "2") } | Sort-Object ClientFolder) | Foreach-Object {If ($_.ClientFolder) {Write-Host ($_.ClientFolder + "\" + $_.DisplayName)} Else {Write-Host $_.DisplayName}} |
List all published applications which start a script (in either VBScript or PowerShell)
This line of code checks the command line of each published application in the farm for the keywords “cscript, “wscript”, “powershell”, “vbs”, “ps1” and “hta”. It than lists each application’s display name including client folder name (if applicable).
1 |
(Get-XAApplication | Where-Object { ($_.CommandLineExecutable -match "script") -or ($_.CommandLineExecutable -match "powershell") -or ($_.CommandLineExecutable -match "vbs") -or ($_.CommandLineExecutable -match "ps1") -or ($_.CommandLineExecutable -match "hta") } | Sort-Object ClientFolder) | Foreach-Object {If ($_.ClientFolder) {Write-Host ($_.ClientFolder + "\" + $_.DisplayName)} Else {Write-Host $_.DisplayName}} |
Dennis Span works as a Lead Account Technology Strategist at Cloud Software Group in Vienna, Austria. He holds multiple Citrix certifications (CCE-V). Dennis has been a Citrix Technology Advocate (CTA) since 2017 (+ one year as Citrix Technology Professional, CTP). Besides his interest in virtualization technologies and blogging, he loves spending time with his family as well as snowboarding, playing basketball and rowing. He is fluent in Dutch, English, German and Slovak and speaks some Spanish.
hi Denis,is there command that can tell when you last accessed your published applications in Xen App 6.5
Hi Liam,
Interesting question. You need a history log to retrieve this kind of information, for example within EdgeSight or a third-party monitoring product. Without historical information, it will not be possible to get the information you want. Another option is to write a logon script that enters logon information in a database, or even a CSV file, that you can access anytime to see the user’s last Citrix session. I hope that I understood your question correctly.