This is a classic but needs to be written somewhere so I can find it again when I need it !
First thing, you need to add the XenApp Powershell snapin :
Add-PSSnapin Citrix*
Then you can use few very useful command to gather information and script your deployment / inventory.
PS H:> get-help xenapp
Name Category Module Synopsis
---- -------- ------ --------
Copy-CtxSystemInformation Cmdlet Citrix.Common.Commands Collects system information.
Set-XAServerLogOnMode Cmdlet Citrix.XenApp.Commands Sets the Logon Mode of a XenApp server
Set-XADefaultComputerName Cmdlet Citrix.XenApp.Commands Sets the default computer name for remoting.
Import-XALegacyApplication Cmdlet Citrix.XenApp.Commands Imports applications from a file.
Move-XAWorkerGroup Cmdlet Citrix.XenApp.Commands Move a XenApp worker group to another folder.
Get-XAServerLoad Cmdlet Citrix.XenApp.Commands Retrieves the load value of a load evaluator on a server.
Set-XAApplication Cmdlet Citrix.XenApp.Commands Sets properties of a published application that is streamed to client or installed on a XenApp server.
Set-XAApplicationLoadEvaluator Cmdlet Citrix.XenApp.Commands Attaches a load evaluator to a XenApp application.
Set-XAServerZone Cmdlet Citrix.XenApp.Commands Sets the zone and election preference for XenApp servers. The server may need reboot.
Remove-XAServer Cmdlet Citrix.XenApp.Commands Removes a XenApp server that is offline from the farm.
Enable-XAServerLogOn Cmdlet Citrix.XenApp.Commands Enables logons to a XenApp server.
Disable-XAServerLogOn Cmdlet Citrix.XenApp.Commands Disables logons to a XenApp server.
Get-XAServer Cmdlet Citrix.XenApp.Commands Retrieves Citrix servers.
Move-XAServer Cmdlet Citrix.XenApp.Commands Move a XenApp server to another folder.
CitrixGroupPolicy Provider Citrix.Common.GroupPolicy Provides access to Citrix policy settings.
That’s what you got access to, now I want to list hotfixes on XenApp servers, I used Get-XaServerHotfix “ServerName”
PS H:> Get-XAServerHotfix Server123
ServerName : Server123
HotfixName : XA650R01W2K8R2X64028
InstalledBy : METALTHIRION
InstalledOn : 25/06/2013 08:16:25
Valid : False
TargetProduct : Citrix XenApp 6.5
HotfixType : Hotfix
LanguageId : 1036
HotfixesReplaced : {XA650R01W2K8R2X64010}
MoreInformationAt :
MachineName : DATACOLECTOR123
ServerName : Server123
HotfixName : XA650R01W2K8R2X64090
InstalledBy : METALTHIRION
InstalledOn : 25/06/2013 11:12:19
Valid : False
TargetProduct : Citrix XenApp 6.5
HotfixType : Hotfix
LanguageId : 1036
HotfixesReplaced : {XA650R01W2K8R2X64002, XA650R01W2K8R2X64006, XA650R01W2K8R2X64009, XA650R01W2K8R2X64024...}
MoreInformationAt :
MachineName : DATACOLECTOR123
ServerName : Server123
HotfixName : XA650R01W2K8R2X64002
InstalledBy : METALTHIRION
InstalledOn : 24/06/2013 16:42:44
Valid : False
TargetProduct : Citrix XenApp 6.5
HotfixType : Hotfix
LanguageId : 1036
HotfixesReplaced : {}
MoreInformationAt :
MachineName : DATACOLECTOR123
ServerName : Server123
HotfixName : XA650R01W2K8R2X64058
InstalledBy : METALTHIRION
InstalledOn : 25/06/2013 09:47:20
Valid : False
TargetProduct : Citrix XenApp 6.5
HotfixType : Hotfix
LanguageId : 1036
HotfixesReplaced : {XA650R01W2K8R2X64003, XA650R01W2K8R2X64021, XA650R01W2K8R2X64041}
MoreInformationAt :
MachineName : DATACOLECTOR123
ServerName : Server123
HotfixName : XA650R01W2K8R2X64033
InstalledBy : METALTHIRION
InstalledOn : 25/06/2013 08:46:24
Valid : False
TargetProduct : Citrix XenApp 6.5
HotfixType : Hotfix
LanguageId : 1036
HotfixesReplaced : {XA650R01W2K8R2X64005}
MoreInformationAt :
MachineName : DATACOLECTOR123
ServerName : Server123
HotfixName : XA650W2K8R2X64R01
InstalledBy : METALTHIRION
InstalledOn : 24/06/2013 16:25:38
Valid : False
TargetProduct : Citrix XenApp 6.5
HotfixType : HRP
LanguageId : 1036
HotfixesReplaced : {XA650W2K8R2X64001, XA650W2K8R2X64002, XA650W2K8R2X64003, XA650W2K8R2X64004...}
MoreInformationAt :
MachineName : DATACOLECTOR123
ServerName : Server123
HotfixName : XA650R01W2K8R2X64075
InstalledBy : METALTHIRION
InstalledOn : 25/06/2013 11:06:50
Valid : False
TargetProduct : Citrix XenApp 6.5
HotfixType : Hotfix
LanguageId : 1036
HotfixesReplaced : {XA650R01W2K8R2X64010, XA650R01W2K8R2X64028, XA650R01W2K8R2X64048, XA650R01W2K8R2X64055}
MoreInformationAt :
MachineName : DATACOLECTOR123
ServerName : Server123
HotfixName : XA650R01W2K8R2X64052
InstalledBy : METALTHIRION
InstalledOn : 25/06/2013 08:53:32
Valid : False
TargetProduct : Citrix XenApp 6.5
HotfixType : Hotfix
LanguageId : 1036
HotfixesReplaced : {XA650R01W2K8R2X64006, XA650R01W2K8R2X64024, XA650R01W2K8R2X64039}
MoreInformationAt :
MachineName : DATACOLECTOR123
ServerName : Server123
HotfixName : XA650R01W2K8R2X64068
InstalledBy : METALTHIRION
InstalledOn : 25/06/2013 11:04:35
Valid : False
TargetProduct : Citrix XenApp 6.5
HotfixType : Hotfix
LanguageId : 1036
HotfixesReplaced : {XA650R01W2K8R2X64003, XA650R01W2K8R2X64021, XA650R01W2K8R2X64041, XA650R01W2K8R2X64058}
MoreInformationAt :
MachineName : DATACOLECTOR123
ServerName : Server123
HotfixName : XA650R01W2K8R2X64088
InstalledBy : METALTHIRION
InstalledOn : 25/06/2013 11:09:23
Valid : False
TargetProduct : Citrix XenApp 6.5
HotfixType : Hotfix
LanguageId : 1036
HotfixesReplaced : {XA650R01W2K8R2X64015, XA650R01W2K8R2X64060}
MoreInformationAt :
MachineName : DATACOLECTOR123
ServerName : Server123
HotfixName : XA650R01W2K8R2X64013
InstalledBy : METALTHIRION
InstalledOn : 25/06/2013 08:11:59
Valid : False
TargetProduct : Citrix XenApp 6.5
HotfixType : Hotfix
LanguageId : 1036
HotfixesReplaced : {}
MoreInformationAt :
MachineName : DATACOLECTOR123
ServerName : Server123
HotfixName : XA650R01W2K8R2X64011
InstalledBy : METALTHIRION
InstalledOn : 24/06/2013 16:45:36
Valid : False
TargetProduct : Citrix XenApp 6.5
HotfixType : Hotfix
LanguageId : 1036
HotfixesReplaced : {}
MoreInformationAt :
MachineName : DATACOLECTOR123
ServerName : Server123
HotfixName : XA650R01W2K8R2X64061
InstalledBy : METALTHIRION
InstalledOn : 25/06/2013 09:54:41
Valid : False
TargetProduct : Citrix XenApp 6.5
HotfixType : Hotfix
LanguageId : 1036
HotfixesReplaced : {}
MoreInformationAt :
MachineName : DATACOLECTOR123
ServerName : Server123
HotfixName : XA650R01W2K8R2X64051
InstalledBy : METALTHIRION
InstalledOn : 25/06/2013 08:50:46
Valid : False
TargetProduct : Citrix XenApp 6.5
HotfixType : Hotfix
LanguageId : 1036
HotfixesReplaced : {}
MoreInformationAt :
MachineName : DATACOLECTOR123
ServerName : Server123
HotfixName : XA650R01W2K8R2X64064
InstalledBy : METALTHIRION
InstalledOn : 25/06/2013 10:57:17
Valid : False
TargetProduct : Citrix XenApp 6.5
HotfixType : Hotfix
LanguageId : 1036
HotfixesReplaced : {}
MoreInformationAt :
MachineName : DATACOLECTOR123
ServerName : Server123
HotfixName : XA650W2K8R2X64R03
InstalledBy : METALTHIRION
InstalledOn : 03/01/2014 13:50:17
Valid : True
TargetProduct : Citrix XenApp 6.5
HotfixType : HRP
LanguageId : 1036
HotfixesReplaced : {XA650R01W2K8R2X64001, XA650R01W2K8R2X64002, XA650R01W2K8R2X64003, XA650R01W2K8R2X64004...}
MoreInformationAt :
MachineName : DATACOLECTOR123
ServerName : Server123
HotfixName : XA650W2K8R2X64R02
InstalledBy : METALTHIRION
InstalledOn : 01/07/2013 11:43:54
Valid : False
TargetProduct : Citrix XenApp 6.5
HotfixType : HRP
LanguageId : 1036
HotfixesReplaced : {XA650R01W2K8R2X64001, XA650R01W2K8R2X64002, XA650R01W2K8R2X64003, XA650R01W2K8R2X64004...}
MoreInformationAt :
MachineName : DATACOLECTOR123
The result format is not very useful and is about only 1 server in a farm of 100… And I was looking for all the servers which had the XA650R01W2K8R2X64061 hotfix installed
I needed to have a list of all servers, only the machine name where this hotfix was installed.
Get-XAServer | Get-XAServerHotfix | Where-Object {$_.HotfixName -like '*XA650R01W2K8R2X64061*'} | Select-Object ServerName
And the result look like this :ServerName
----------
ServerName0204P
ServerName0205P
ServerName0206P
ServerName0207P
ServerName0209P
ServerName0208P
ServerName0213P
ServerName0212P
ServerName0211P
ServerName0210P
ServerName0218P
ServerName0215P
ServerName0217P
ServerName0214P
ServerName0219P
ServerName0216P
ServerName0223P
ServerName0222P
ServerName0225P
ServerName0227P
ServerName0229P
ServerName0228P
ServerName0226P
ServerName0224P
ServerName0221P
ServerName0220P
ServerName0232P
ServerName0235P
ServerName0234P
ServerName0233P
ServerName0244P
ServerName0240P
ServerName0250P
ServerName0253P
ServerName0242P
ServerName0236P
ServerName0238P
ServerName0254P
ServerName0243P
ServerName0246P
ServerName0237P
ServerName0248P
ServerName0241P
ServerName0251P
ServerName0245P
ServerName0252P
ServerName0249P
ServerName0239P
ServerName0255P
ServerName0247P
ServerName0257P
ServerName0258P
ServerName0256P
ServerName0262P
ServerName0261P
ServerName0260P
ServerName0264P
ServerName0263P
ServerName0259P
ServerName0265P
This is simple and quite basic but it’s very useful ! if you have any comment and/ or request, just drop me an email or comment !