Quantcast
Channel: VMware Communities : All Content - VMware PowerCLI
Viewing all articles
Browse latest Browse all 16717

shutdown-vmguest and set cpu and mem

$
0
0

will this work?

have not had a chance to test

 

$vms = get-vm -name (get-content vms.txt)

foreach ($vm in $vms) {

get-VM -name $vm | Shutdown-VMGuest -Confirm:$false

if ($VM.PowerState -eq "PoweredOn") {

   Write-Host "Shutting Down" $VMName

   Shutdown-VMGuest -VM $VM

   #Wait for Shutdown to complete

   do {

      #Wait 5 seconds

      Start-Sleep -s 5

      $status = $VM.PowerState

   }until($status -eq "PoweredOff")

}

$vm | Set-VM –MemoryGB 8 –NumCpu 2 –Confirm:$False

$vm  | Start-VM

}


Viewing all articles
Browse latest Browse all 16717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>