#############################################################################################################
#
# By: Trentent Tye - Intel Server
#
# Date: 2014-07-14
#
# Comment: This script was written to extend the available free space on Citrix PVS servers. It uses
# a text file with the list of servers that need their disk space extended. It assumes disk 0
# needs extended by default because that's the only disk on a provisioned server. Use with
# caution against other servers.
#
#
##############################################################################################################
$executingScriptDirectory = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
pushd $executingScriptDirectory
cd $executingScriptDirectory
$servers = get-content serverlist.txt
foreach ($server in $servers) {
Get-HardDisk -vm $server | Set-HardDisk -CapacityGB 40 -ResizeGuestPartition -Confirm:$false
echo "select volume 0" | out-file -FilePath \\$server\c$\swinst\diskpart.txt -Encoding ASCII -force
echo "extend" | out-file -FilePath \\$server\c$\swinst\diskpart.txt -Encoding ASCII -Append -force
.\psexec.exe -accepteula \\$server diskpart.exe /s C:\swinst\diskpart.txt
}
########################
ServerList.txt
Server1
Server2
Server3
#######################