I am starting with powershell to create snapshots before running windows update.
i had created this loop, it works but this will only create 1 snapshot simultaneously, i want to 2 servers at the same time to create snapshots and not more then 2.
$VMs = Get-Content arr_vCenter_VMs.txt
foreach($tmpVM_Name in $VMs)
{
$dtMDYT = Get-Date -Format G
Get-VM $tmpVM_Name | New-Snapshot -Name “$tmpVM_Name $dtMD” -Description “$dtMDYT – Snapshot prior to Windows Updates Installation via UpdateAutoPilot-vCenter.ps1” -Memory:$true -Confirm:$false | Out-File C:\VMWare_snapshots.log -append -Width 500
}
We’ve discovered that creating snapshots for 2 servers is the optimal setting not to have a high cpu load on our servers. if we do 1 it will take to much time.
foreach is the most simple loop i can use, but maybe i should go to a while loop with a counter, but not having many experience with that.