# found https://vmscribble.com
Write-Host "
The script will add a new disk drive on the first SCSI adapter based on the VM memory size times 1.5
"
# Connect to your vCenter
$vCenter = Read-Host "Enter the vCenter FQDN"
Connect-VIServer $vCenter
Write-Host " "
$textfile = Read-Host "Enter the location and text file name of VMs in scope"
$listofvms = Get-Content -path $textfile
# change 1.5 to another multiple in line: $size = $thevm * 1.5
foreach ($vm in $listofvms)
{
$thevm = get-vm $vm | Select-Object -ExpandProperty MemoryGB
$size = $thevm * 1.5
get-vm $vm | New-HardDisk -CapacityGB $size | Select-Object Parent, Filename, CapacityGB
}
# Disconnect from the vCenter
Disconnect-VIServer $vCenter -Confirm:$false