Introduction
When publishing an image to PVS the Citrix App Layering PVS Connector allows for running a PowerShell script after an image in uploaded to the PVS Store and Added as a vDisk.
This sample script is intended to show Citrix customers how this scripting can be used to increase administrative productivity.
The script provides the following features which can be enabled or disabled as desired:
- A way to convert the uploaded vhd to a vhdx format
- The ability to make uploaded image versions behave like PVS versions so that changes can be deployed using PVS versioning
Limitations
In order to use this script there are several important limitations to be aware of:
- When using a script the image publish tasks will complete before the script has been run. It may be necessary to wait to use a vDisk if the script is still running.
- 该脚本已经写的支持PVS Powershell CMDLETS for PVS 7.7 and later. A separate script is required for earlier versions of PVS.
- The Versioning scripting will look for an existing vDisk with a name that starts with the image name. Therefore image names cannot be contained within another image name. For example you would not want to name two images as follows becasue the images would get combined.
- Accounting
- Accounting_Systems
- If you are using the convert from vhd to vhdx with versioning you must start with a new image name or remove all the old vDisks for your image so that all of the versions are of the same disk type.
Note: The full path of the vDIsk cannot be longer than 127 characters. This includes the store path.
Warning
这个示例脚本由Citrix提供解决方案Architects as an example of useful extensions that can be made to Citrix App Layering. These scripts have been tested in our labs but not by our QA department and they are not supported as part of the Citrix App Layering Product. Please test thoroughly and implement with care.
Note: The VHDX conversion process used by this example script may create significant processor and storage utilization when several iterations are run in parallel. When used in production environments it may be preferable to create a PVS Server used only to support this scripting process and other development tasks. That way this processing will never affect production PVS Server efficiency.
Infrastructure Requirements
The following infrastructure components/configurations are required:
- The VHDX conversion requires a disk conversion utility. The sample script uses a free utility namedQEMU-IMG for Windows.
This utility does not need to be installed. Place the binaries in your script folder.
- I have also used Starwind converter in the past. They have afree conversion tool
- The script makes extensive use of PVS Powershell CMDLETS and this version will only support PVS 7.7 and later. Refer to Citrix eDocs for thedirections to initialize the PVS Powershell(Pages 12-13)
- PowerShell Execution Policy must be set to remote-signed or unrestricted
- The account defined in the script configuration of the connector must be a local administrator, and PVS administrator and it must have modify rights to the script folder.
Setting Up the Script
- The first step when setting up the script is to create a folder. A folder off the root with no spaces in the name is recommended.
- If the script file is blocked unblock it.
- Add the VHDX conversion utility to the script folder. If using qemu-umg.exe just copy the files into the script folder.
- Edit the PVS connector, click on the Scripts tab and configure the script.
![file](http://m.giftsix.com/support/files/public/support/article/CTX226060/images/0EM4z000000jpmp.png)
Note: If a dash(-) is found n the script name script execution will fail.
- Edit the script and modify the configuration settings defined in lines 14-33 as desired.
![file](http://m.giftsix.com/support/files/public/support/article/CTX226060/images/0EM4z000000jpmq.png)
To enable or disable a feature set it to %true or $false
Note: When publishing multiple simultaneous images the check for space may not allow for all images because up to four images will be uploaded in parallel and each script is run separately. For the conversions to work there must be double space for each image being processed up to four at one time.
Test
It is critical to test the script on test vdisks on a test PVSServer. Test all the way to deploying targets using the VHDX if using the VHD to VHDX conversion.
The script creates a detailed log. Review the log after each test.