“How do I add or create a new administrator in my XenDesktop site?”
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:
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:
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:
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:
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:
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.