Skip to content

Useful XenDesktop Powershell Commands

by on July 19, 2013

The commands below came in very handy at a project I recently did for a customer.

Scenario: Provides list of all identity pools and detailed information about them, e.g., lock status and UID. This can be very useful when troubleshooting general catalog errors.

Command: Get-AcctIdentityPool

Scenario: An attempt was made to delete a computer from the catalog and it failed mid-process. The account may have been deleted from Active Directory but left in an “in use” state in the catalog. To be able to reuse that computer name, the computer will have to be removed using the SID. The Get command will provide an administrator with the computer’s SID. Once the SID has been obtained, an administrator can then run the Remove command using the SID information.

Command 1: Get-AcctADAccount -IdentityPoolName “POOL NAME

Command 2: Remove-AcctADAccount -IdentityPoolName “POOL NAME” -ADAccountSid “SID NUMBER” -Force

Scenario: If a computer account becomes disabled or locked and goes into an “error” state, this command will resync the account with AD. This would usually happen when an account is manually deleted or disabled in AD but not from the catalog.

Command: Update-AcctADAccount -IdentityPoolName “POOL NAME

Scenario: Once a catalog has been created, an administrator will no longer be able to change the CPU and memory size through the studio. Instead, the administrator will have to use the commands below. The first command an administrator will need to run is Get-ProvSchema to obtain the ProvisioningSchemaName. Once that’s been obtained, an administrator will then run the Set-ProvSchema to update the memory and CPU data.

Command 1: Get-ProvSchema

Command 2: Set-ProvScheme -ProvisioningSchemeName “Schema Name” -VMMemoryMB “4096″

Command 3: Set-ProvScheme -ProvisioningSchemeName “Schema Name” -VMCpuCount “2″

Note: There’s no command to modify the PVD disk size. Although it can be modified by directly editing SQL, it isn’t a supported method. To change the PVD size after the catalog has been created, consult this Citrix KB article. Be aware, the method mentioned in this article will only apply to existing machines. Any new machines will continue using the size specified during the creation of the catalog.

Scenario: An administrator attempts to make a change to a catalog and the studio freezes up, forcing the administrator to “end task” the console. In some situations, this might cause the catalog to enter into a “locked” state preventing any further changes to the catalog. The commands below will help with unlocking the catalog.

Command 1: Get-AccdIdentityPool

Command 2: Unlock-AcctIdentityPool -IdentityPoolName “POOL NAME

Scenario: When creating a catalog, an administrator has to choose data stores to be included in the catalog. If one of the data stores added fails or is removed from the hypervisor, the data store will need to be removed from the catalog as well. Otherwise, future attempts to update the catalog will fail. The first task is to find out the HypeHostingUnitStorage “path.” To do that, an administrator will first have to run the LS command to list all the HostingUnitStorages. Once that command has been run, an administrator should be able to find the storage path under the Storage field. With the Path available, an administrator can run the Remove command to remove the data store.

Command 1: CD XDHyp

Command 2: CD HostingUnits

Command 3: LS

Command 4: Remove-HypHostingUnitStorage -LiteralPath “PATH” -StoragePath “PATH” -StorageType PersonalvDiskStorage

Comments are closed.

%d bloggers like this: