Question: “How do I add or create a new administrator in my XenDesktop site?”

Answer: A XenDesktop administrator is basically composed of two things: The administrator object (whose name matches a user or group that already exists in Active Directory) and the rights assigned to the administrator (basically Role and Scope pairs).

In this example we will use a XenDesktop 7 site in an Active Directory Domain called “AUTOINF” and adding an administrator called “JoeAdmin”. First, we start with a PowerShell session using a user that has permissions to manage the XenDesktop site and with the Delegated Admin PowerShell Snap-in loaded (Add-PSSnapin Citrix.DelegatedAdmin.Admin.V1). Then, we create a new administrator as follows:

New-AdminAdministrator -Name "AUTOINF\JoeAdmin"

Next, we can query for the available Roles and Scopes that we can assign to our newly created administrator. We do this by running the following 2 cmdlets:

Get-AdminRole

Get-AdminRole

Get-AdminScope

Get-AdminScope

After discovering and taking note of the Role and Scope we want to add – in this case we will use the read only one. We can run the following command to add the rights:

Add-AdminRight -Administrator "AUTOINF\JoeAdmin" -Role "Read Only Administrator" -Scope "All"

Finally, we can confirm the addition and changes of the administrator by querying for the new administrator and seeing the returned object with the assigned rights:

Get-AdminAdministrator -Name "AUTOINF\JoeAdmin"

Get-AdminAdministrator_AUTOINF-JoeAdmin

Keep in mind that we executed these commands in a PowerShell session running on the Delivery Controller. If we were running these remotely from a machine that had the required Citrix Delegated Admin PowerShell Snap-in installed, then you can set the AdminAddress parameter on each command to the address of the Delivery Controller. Here’s an example of the first command we executed, but this time with the AdminAddress parameter:

New-AdminAdministrator -Name "AUTOINF\JoeAdmin" -AdminAddress "controller1.autoinf.com"

You can also create/modify roles, add/change permissions, among other things, with these Cmdlets. So while these actions can also be done through the Citrix Studio UI, it is important to recognize the value in being able to programmatically configure XenDesktop administrators using PowerShell.

Happy Scripting!

Santiago Cardenas

Citrix Solutions Lab