Disk with a blocksize of 1. MB. As we would like to use the disk for writing the image to, the disk should be in private mode which is accomplished via type1. Script Createv. Disk. Unattended Creation of v. Disk Creator Wilco van Bragt Creation Date 1. Import Modules Import Module Force FunctionDefine Variables PVSSite. ValueVan. Bragt. Site PVSStore. Value v. Disks. PVSUser Defined Variables v. Disk. NameRead Host Please enter the name of the v. DiskCreate v. Disk Mcli Run. With. Return Create. Disk p namev. Disk. Name,size4. PVSStore. Value,Site. NamePVSSite. Value,servernameenv computername,type1,vhd. Block. Size1. 63. Change v. Disk to Shared Mode. The second script is to convert the disk into a shared image after the image has been written to the v. Disk. Again the PVS Site and PSV Store are required and defined as a variable in the beginning of the script. Again the person running the script should provide the name of the v. Disk that should be converted into the shared mode. The conversion is based on two Power. Shell script. The first part based on mcli Set Disk converts the disk into the shared mode. In this case we are using RAM for the write cache write. Cache. Type3, with a write cache of 2. GB write. Cache. Type3 and WindowsOffice licensing is based on KMS license. Mode2. The second part via the command Mcli Set Disk. Locator arranges that the disk is load balanced over the available PVS servers. This is arranged by specifying the parameter Server. Name without a value, but with double quotes Server. Name. We are using in this case Load Balancing based on Best Effort subnet. Affinity1 and rebalancing enabled rebalance. Enabled1. Script Changev. Diskto. Shared. Xen. App. 65. ps. 1 Unattended Changing v. Disk to Shared including Xen. App 6. 5 PVS settings Creator Wilco van Bragt Creation Date 2. Import Modules add PSSnap. In mclipssnapinDefine Variables PVSSite. ValueVan. Bragt. Site PVSStore. Value v. Disks. PVSUser Defined Variables v. Disk. NameRead Host Please enter the name of the v. DiskChange v. Disk Settings mcli Set Disk p disk. Locator. Namev. Disk. Name,site. NamePVSSite. Value,store. NamePVSStore. Value r write. Cache. Size2. 04. Cache. Type3,license. Mode2. Mcli Set Disk. Locator p disk. Locator. Namev. Disk. Name,site. NamePVSSite. Value,store. NamePVSStore. Value r rebalance. Enabled1,subnet. Affinity1,Server. NameCreate Template Target Device. I used a Template device that is being used to set up additional Target Device with the correct settings. I added this part of the script to the unattended installation of the first PVS server I created it later, so thats why its not mentioned in the article series Unattended Installation of PVS. Creating a Template is done in two phases. The first step is to create a device. A device has some required fields like collection name and site name, which are available as parameters in an earlier phase of the installation scripts. Also a Mac Address is required, but as it is a template you can fill it with dummy information for example all zeros. We decided that we would like to log error message of the Target Devices, so we change the Loglevel to Error log. Level2 of the template so Target Devices created based on the template are inheriting the log level. The second step is to convert the created device into a template. As a template belongs to a Device Collection its done via Power. Shell command mcli Set Collection. It took me a while to find that out, I expected this to be a device parameter. PSSnapin Name mclipssnapindevice. NameTemplate,collection. NamePVSCollection. Value,site. NamePVSSite. Value,device. Mac0. Level2mcli Set Collection p Collection. NamePVSCollection. Value,site. NamePVSSite. Value r templatedevicenameTemplateAdd Target Devices Adding a Taret Device manually is a time consuming activity and although there are some tools available, I prefer to add the target devices using a script. The script requires a file with the computername and the MAC address defined per line. In our situation we have a script that fills this file automatically when creating the Virtual Machines. To keep the script flexible I added a component to specify the file name in which the Target Devices are entered. Secondly creating a Target Device requires a Site and Collection where the Target Device should be added. The script reads out the Target Devices per line and add the Target Device via the Mcli Add Device to the PVS Farm using the MAC address and Name specified in the file. By specifying copy. Template1 the settings of the template devices are inherited. Secondly the Target Device is also added to Active Directory as a computer object. Besides the device name you need to specify the OU where the object should be created. As this was a fixed location we just entered the location into the script, but you can create some logic around that if required. Script Add. Target. Device. Xen. App. Add Target Devices Creator Wilco van Bragt Creation Date 2. The file that will be used need to be formatted devicename,Ma. Caddress per line Import Modules add PSSnap. In mclipssnapin Define Variables PVSSite. ValueVan. Bragt. Site PVSCollection. Value Van. Bragt.