Here’s a cheat sheet with some common commands used in Citrix Virtual Apps and Desktop deployments, along with their explanations:
Of course, start with the below command to load all the Citrix PS modules first
asnp citrix*
I would suggest you run the below commands as per your requirement and then select the specific parameters to fine tune the results.
For eg, if I need to find all the machines in a CVAD (XenApp) farm, I would just run the command Get-BrokerMachine and then look at the specific information that I want to filter the results on. The below filter would come in very handy when you want to look for specific info.
Get-BrokerMachine | Select-Object -Property MachineName
Now if you want to also see the Machine catalog names alongside the VM name, then try the below
Get-BrokerMachine | Select-Object -Property MachineName, CatalogName
You can also pipe the results into a CSV or text file depending on your needs. For that,
Get-BrokerMachine | Select-Object -Property MachineName, CatalogName | Export-Csv C:\temp\Machinename.csv
This should get you started. Hope this helps!
Command | Explanation |
---|---|
Broker PowerShell commands | |
Get-BrokerApplication | Returns a list of published applications. |
Get-BrokerCatalog | Returns a list of catalogs containing desktops. |
Get-BrokerDesktop | Returns a list of desktops. |
Get-BrokerMachine | Returns a list of machines in the site. |
Get-BrokerSite | Returns the configuration for the site. |
New-BrokerDesktopGroup | Creates a new desktop group. |
New-BrokerIcon | Creates a new published application icon. |
New-BrokerMachineCatalog | Creates a new machine catalog. |
Remove-BrokerApplication | Removes a published application. |
Remove-BrokerDesktop | Removes a desktop. |
Remove-BrokerMachine | Removes a machine. |
Set-BrokerAccessPolicyRule | Modifies an access policy rule. |
Set-BrokerCatalogPowerAction | Configures power management settings for a catalog. |
Set-BrokerDesktopGroup | Modifies a desktop group. |
Set-BrokerIcon | Modifies a published application icon. |
Set-BrokerMachine | Modifies a machine. |
Citrix Studio commands | |
Add-BrokerEntitlementPolicyRule | Adds an entitlement policy rule. |
Add-BrokerMachine | Adds a machine to the site. |
Add-BrokerTag | Adds a tag to a machine or catalog. |
Export-BrokerDesktopGroup | Exports a desktop group configuration to a file. |
Get-BrokerEntitlementPolicyRule | Returns a list of entitlement policy rules. |
Get-BrokerEntitlementPolicyRuleFilter | Returns a list of entitlement policy rule filters. |
Get-BrokerHostingPowerAction | Returns a list of power management settings for machines. |
Get-BrokerMachineConfiguration | Returns the configuration for a machine. |
Import-BrokerDesktopGroup | Imports a desktop group configuration from a file. |
Remove-BrokerEntitlementPolicyRule | Removes an entitlement policy rule. |
Remove-BrokerMachineTag | Removes a tag from a machine or catalog. |
Set-BrokerDesktop | Modifies a desktop. |
Set-BrokerEntitlementPolicyRule | Modifies an entitlement policy rule. |
Set-BrokerTag | Modifies a tag. |
Test-BrokerCatalog | Tests the connection to a catalog. |
Let’s look at some PowerShell commands to manage DDCs and Storefronts
Command | Explanation |
---|---|
Delivery Controller commands | |
Get-BrokerController | Returns the configuration for a Delivery Controller. |
Set-BrokerController | Modifies the configuration for a Delivery Controller. |
Get-BrokerDesktopSession | Returns a list of active sessions for a desktop. |
Get-BrokerSessionPolicy | Returns a list of session policy settings. |
Set-BrokerSessionPolicy | Modifies session policy settings. |
Get-BrokerTagRestriction | Returns a list of tag restrictions. |
Set-BrokerTagRestriction | Modifies tag restrictions. |
Get-BrokerUser | Returns information about a user. |
Get-BrokerUserSession | Returns a list of active sessions for a user. |
Get-BrokerUserTag | Returns a list of tags assigned to a user. |
Set-BrokerUserTag | Modifies the tags assigned to a user. |
Add-BrokerMachineCatalogTagRestriction | Adds a tag restriction to a machine catalog. |
Remove-BrokerMachineCatalogTagRestriction | Removes a tag restriction from a machine catalog. |
Add-BrokerDesktopGroupUser | Adds a user to a desktop group. |
Remove-BrokerDesktopGroupUser | Removes a user from a desktop group. |
Get-BrokerDesktopGroupMember | Returns a list of members of a desktop group. |
Get-BrokerLogonData | Returns logon data for a user. |
Get-BrokerSiteAggregationState | Returns the aggregation state of the site. |
Start-BrokerRebalance | Starts the rebalance process for a machine catalog. |
Stop-BrokerRebalance | Stops the rebalance process for a machine catalog. |
Citrix StoreFront commands | |
Add-STFAppGroupMember | Adds a published application to an application group. |
Add-STFAppStore | Adds a Citrix StoreFront store to a Citrix Receiver client. |
Get-STFAppStore | Returns a list of Citrix StoreFront stores. |
Get-STFAppSubscription | Returns a list of subscribed applications. |
Remove-STFAppGroupMember | Removes a published application from an application group. |
Remove-STFAppStore | Removes a Citrix StoreFront store from a Citrix Receiver client. |
Set-STFAppStore | Modifies the configuration for a Citrix StoreFront store. |
Machine Catalog and Delivery group PowerShell Commands
Command | Explanation |
---|---|
Machine Catalog commands | |
New-BrokerMachineCatalog | Creates a new machine catalog. |
Set-BrokerMachineCatalog | Modifies the configuration of a machine catalog. |
Remove-BrokerMachineCatalog | Removes a machine catalog. |
Add-BrokerMachine | Adds a machine to a machine catalog. |
Remove-BrokerMachine | Removes a machine from a machine catalog. |
Enable-BrokerMachine | Enables a machine in a machine catalog. |
Disable-BrokerMachine | Disables a machine in a machine catalog. |
Set-BrokerMachinePowerAction | Configures the power action settings for a machine catalog. |
Get-BrokerMachine | Returns information about a machine. |
Set-BrokerMachine | Modifies the configuration of a machine. |
Delivery Group commands | |
New-BrokerDesktopGroup | Creates a new desktop group. |
Set-BrokerDesktopGroup | Modifies the configuration of a desktop group. |
Remove-BrokerDesktopGroup | Removes a desktop group. |
Add-BrokerDesktopGroupMember | Adds a machine or user to a desktop group. |
Remove-BrokerDesktopGroupMember | Removes a machine or user from a desktop group. |
Get-BrokerDesktopGroup | Returns information about a desktop group. |
Set-BrokerDesktopGroupPolicy | Modifies the policy settings for a desktop group. |
Get-BrokerDesktopGroupPolicy | Returns the policy settings for a desktop group. |
Get-BrokerApplication | Returns information about a published application. |
New-BrokerApplication | Creates a new published application. |
Set-BrokerApplication | Modifies the configuration of a published application. |
Remove-BrokerApplication | Removes a published application. |
Get-BrokerApplicationInstance | Returns information about a published application instance. |
New-BrokerApplicationInstance | Creates a new published application instance. |
Set-BrokerApplicationInstance | Modifies the configuration of a published application instance. |
Remove-BrokerApplicationInstance | Removes a published application instance. |
To find all the commands starting with a particular string or word, just type part of the PS cmdlet that you are looking for and press CTRL and SPACEBAR. This will invoke the IntelliSense help from within PowerShell. Eg below
Get-Broker
This way you can also see all the filters available for a PowerShell cmdlet
Another way of seeing the filters is by the use of Show-Command
Show-Command -Name <powershell command>
Doing so will invoke a GUI windows listing all the filters that you could use.
Now, how do you find the list of all the published applications in a farm along with who has got access to them.
Get-BrokerApplication | Select-Object Name, AssociatedUserFullNames, PublishedName | Format-Table
Here are ALL the switches that you can use for applications if you want to further fine-tune your results.
Parameters |
AdminFolderName |
AdminFolderUid |
AllAssociatedDesktopGroupUUIDs |
AllAssociatedDesktopGroupUids |
ApplicationName |
ApplicationType |
AssociatedApplicationGroupUUIDs |
AssociatedApplicationGroupUids |
AssociatedDesktopGroupPriorities |
AssociatedDesktopGroupUUIDs |
AssociatedDesktopGroupUids |
AssociatedUserFullNames |
AssociatedUserNames |
AssociatedUserSIDs |
AssociatedUserUPNs |
BrowserName |
ClientFolder |
CommandLineArguments |
CommandLineExecutable |
ConfigurationSlotUids |
CpuPriorityLevel |
Description |
Enabled |
HomeZoneName |
HomeZoneOnly |
HomeZoneUid |
IconFromClient |
IconUid |
IgnoreUserHomeZone |
LocalLaunchDisabled |
MachineConfigurationNames |
MachineConfigurationUids |
MaxPerMachineInstances |
MaxPerUserInstances |
MaxTotalInstances |
MetadataKeys |
MetadataMap |
Name |
PublishedName |
SecureCmdLineArgumentsEnabled |
ShortcutAddedToDesktop |
ShortcutAddedToStartMenu |
StartMenuFolder |
Tags |
UUID |
Uid |
UserFilterEnabled |
Visible |
WaitForPrinterCreation |
WorkingDirectory |
I will keep updating the list as we go.
Note that this is just a selection of commands and their explanations, and there are many more available. It’s always a good idea to refer to official Citrix documentation and best practices when using these commands in production environments.
Leave a comment