1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
############################################################################################################# # # 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 } |
1 2 3 4 5 6 |
######################## ServerList.txt Server1 Server2 Server3 ####################### |