-
How to Automate Enabling PVS-Accelerator on Citrix Provisioning Target Devices
December 10, 2020
Recently, in one of the Slack Workspaces I am part of, someone asked how to enable PVS-Accelerator on numerous Citrix Provisioning (PVS) target devices. I wrote this article to explain how I came up with a Proof of Concept (PoC) script.
“Is there any way to enable PVS Accelerator on all target devices in a large collection? So far, I find no script or PowerShell to do this.”
I had a little bit a time between conference calls, so I thought this would be an easy problem to solve. Five hours later, I figured it out and had a working PoC script.
I asked for information on the PVS, target device VDA, target device Windows, and hypervisor versions. I then built a matching environment as best I could.
To understand what PVS-Accelerator is, its requirements, and how it works, please read this from the product documentation.
Since this is not an article on installing, configuring, and using PVS-Accelerator, here are the items I completed in my lab.
- Installed and configured PVS 1912 LTSR CU2
- Installed and configured PVS-Accelerator in my Citrix Hypervisor (XenServer) 8.2 pool
- Installed a CVAD 1912 LTSR CU2 Delivery Controller
- Built a Windows 10 VM and installed the CVAD 1912 LTSR CU2 VDA
- Captured the Windows 10 VM into PVS
- Created a template of the VM
- Used the Citrix Virtual Desktops Setup Wizard (VDSW) to create three target devices
I noticed that my three target devices had PVS-Accelerator disabled, as shown in Figure 1.
I found out I had a typo between the Site name between PVS and what I entered when configuring the PVS-Accelerator in XenServer. Once I had that typo corrected, I used the VDSW to create a fourth target device. That target device has PVS-Accelerator enabled, as shown in Figure 2.
Now I was faced with the same issue as the person who asked the question; How do I automate enabling PVS-Accelerator on the other three target devices?
Time to head to the Citrix developer documentation and search the Citrix Provisioning Services PowerShell page. I changed the Versions, Figure 3, to 1912.
As shown in Figure 4, I searched for “Accelerator”, which seemed obvious to me.
I guess that isn’t as obvious as I thought it would be. I do not see search results for setting PVS-Accelerator for a device.
I can see in Figures 5 and 6 the PVS-Accelerator Enabled option on one of the first three devices and the fourth device.
OK, this “PVS-Accelerator Enabled” property must exist in the device.
After running Get-PVSDevice -Name BaseName004, I get what you see in Figure 7.
I don’t see a property that has “pvs” or “accelerator” in its name. Maybe it is the other device cmdlet, Get-PvsDeviceInfo, as shown in Figure 8.
Nope, nothing there either.
Finding this information is getting frustrating. Looking back at the PVS-Accelerator documentation, in the section How does PVS-Accelerator work, it stated, “PVS-Accelerator employs a Proxy mechanism that resides in the Control Domain (dom0) of Citrix Hypervisor”. OK, how about looking for the word “proxy”. In the results from Get-PvsDevice and Get-PvsDeviceInfo, the only property with “proxy” in the name is XsPvsProxyUuid.
I know I want to set a value for a property for a device. How about looking in the help text for Set-PvsDevice. I did a Get-Help Set-PvsDevice -Full, and then a Find for “proxy”, as shown in Figure 9.
Maybe this “EnableXsProxy” is what I need? Searching for “EnableXsProxy” yields the result shown in Figure 10.
Maybe the parameter “-EnableXsProxy” is what I need.
I will try it on the target device, BaseName001.
Figures 2 and 5 show the “Before”.
Figure 11 shows running the Set-PvsDevice cmdlet.
Note: I used -PassThru to get the PVS Device object returned.
There was no error returned from running the cmdlet, but I do not see either an XsProxy or EnableXsProxy property.
What do the PVS Console and XenCenter show? Figures 12 and 13 show that the option PVS-Accelerator Enabled is now enabled.
For the target device BaseName001, the PVS-Accelerator status shows as Stopped because it is off. After powering on the device from the PVS Console, the status changes, as shown in Figure 14.
For BaseName002, I will try the example from the help text:
EXAMPLE 1: Set PvsDevice for Individual Fields $o = Get-PvsDevice -Name theDevice -Fields LocalWriteCacheDiskSize $o.LocalWriteCacheDiskSize = 1024 Set-PvsDevice $o Get the PvsDevice into a $o variable. Change the $o field values and then Set the PvsDevice with the result. The -Fields parameter with only the needed fields specified makes the Get work faster because only those fields are retrieved.
Figure 15 shows the results of running: $o = Get-PvsDevice -Name “BaseName002” -Fields EnableXsProxy.
OOPS! It looks like the EnableXsProxy property is not stored with the device. It would be nice to know where this property is stored. Using the PowerShell cmdlets, there is no way to retrieve the setting for PVS-Accelerator Enabled.
It appears that using Set-PvsDevice is the only way to process multiple target devices.
Here is the PoC script I came up with to automate enabling PVS-Accelerator for all target devices in a collection.
Import-Module "C:\Program Files\Citrix\Provisioning Services Console\Citrix.PVS.SnapIn.dll" $Devices = Get-PvsDevice -CollectionName <CollectionName> -siteName <SiteName> ForEach($Device in $Devices) { Write-Host "Processing target device $($Device.name)" $DevGuid = $Device.Guid.Guid $null = Set-PvsDevice -EnableXsProxy 1 -Guid $DevGuid }
The first thing I did was to manually disable PVS-Acceleration for all the target devices, as shown in Figure 16.
Figure 17 shows the script running.
With all four target devices powered on, Figure 18 shows the PVS-Accelerator status.
Now that I enabled PVS-Acceleration for all the target devices, I have more questions than answers.
- Why was this so hard to figure out?
- Why does the property name have nothing obvious to do with PVS-Accelerator?
- Why is the EnableXsProxy property not stored with the device?
- Why is there no way to determine the status of PVS-Accelerator for a target device outside of using XenCenter or the PVS Console and manually checking each target device?
I learned four lessons from creating this PoC script.
- Since the state of PVS-Accelerator is unknown and undeterminable for a target device, there is no way to know the state and skip target devices with the state enabled. For a device collection that contains hundreds or thousands of devices, you must process every device, whether needed or not.
- In my testing, using Measure-Command, it takes between 500 and 600 milliseconds to process a device with the Default setting of EnableXsProxy of “” and 6 milliseconds to process one with EnableXsProxy set to 1.
- There is no return status given, so there is no way to know if attempting to set EnableXsProxy to 1 succeeded or failed.
- Since the state of PVS-Accelerator is unknown and undeterminable, there is no way to filter only those devices that need the state changed.
If this were a script I would release to the community, here are some changes I would make.
- Add full help text
- Add parameters for the PVS Site and Device Collection
- Verify the data entered for the parameters
- Use an environment variable for “C:\Program Files” when importing the PVS module
I always create a transaction log file that shows what the script did with the computers processed, but that would not be possible with this script because of the four lessons listed above.
2 Responses to “How to Automate Enabling PVS-Accelerator on Citrix Provisioning Target Devices”
Leave a Reply
September 16, 2024 at 3:55 pm
I do not see an option on 2203 CU5 Properties of the vDisk
September 17, 2024 at 3:35 am
Since I am semi-retired and last updated the PVS scripts a long time ago, PVS is no longer running in what is left of my lab. I think you should contact the World of EUC community on Slack.
https://join.slack.com/t/worldofeuc/shared_invite/zt-2qx2afg8h-rkQx0Bl4RYFVHyX0NVscBA (this link expires on October 17, 2024).
https://worldofeuc.org/
There is a citrix-provisioning channel.
Thanks
Webster