Working on a project for a customer, I was asked to change the drive letter for Citrix PVS write cache from default D:\ to W:\.
After some researches, I found the following Citrix article:
https://support.citrix.com/article/CTX133476
The instructions are well detailed and work fine, however as the target for this customer is 1,200 PVS VDAs, we need to find another way to make this happen.
The solution was to create a PowerShell script that is declared in a Computer Policy as startup script.
Here is the script:
<#
.SYNOPSIS
Change Write Cache Location for PVS VDAs.
.DESCRIPTION
The script will need to be configured in a Policy under Computer Configuration > Policies > Windows Settings > Scripts > Startup
Before implementation, you will need to do the following on your Master Image
1. Connect to PVS Master Image
2. Open CMD as Administrator
3. Run Diskpart
4. List disk
5. Select disk that will contain WriteCache
6. Run uniqueid disk and retrieve the value
You will need a Temp folder on the C:\ Drive.
Change Target Drive Letter on line 31
Change Disk value on line 35
Change UniqueID Disk ID on line 36
The script will first test if Target drive exist, if not it will run and change uniqueid disk for write cache
to make it Target
.NOTES
NAME: WriteCache.ps1
VERSION: 1.00
AUTHOR: Arnaud Pain
LASTEDIT: February 15, 2022
#>
If (-not (Test-Path -Path "TBD")) {
# Test if Target drive exist.
If (-not (Test-Path "C:\Temp\diskpart")) { New-Item -Path "C:\Temp\diskpart" -ItemType Directory }
# Define Diskpart Values and create file.
$DiskpartScript = "SELECT DISK TDB
UNIQUEID DISK ID=TBD"
Set-Content -Path "C:\Temp\diskpart\Partition.txt" -Value $DiskpartScript
# Run Diskpart with argument.
Start-Process -FilePath "diskpart.exe" -ArgumentList "/s C:\Temp\diskpart\Partition.txt" -Wait
# Remove Temp location from VDA.
Remove-Item -Path "C:\Temp\diskpart" -Force -Recurse
# Reboot the VDA
shutdown /r /t 0
}
Feel free to test and share it!