Hello, This is a part of my script for Deploying that changes MEM,CPU,HARDDISK,etc
I have an alert set to send an email each time I change the settings for a VM.
When I run this Script, it gives me around 6 alert messages(email) for each VM I deploy.
I cannot change the settings for alert messages.
Is there any way I can make this script into one so that there will be only one alert messages for each VMs?
Get-VM $VMName | Set-VM -MemoryGB $Memory -NumCpu $Cpu -Confirm:$false
Get-VM $VMName | Get-VMResourceConfiguration | Set-VMResourceConfiguration `
-CpuReservationMhz $CpuRes `
-CpuSharesLevel $CpuShare `
-MemReservationMB $MemoryRes `
-MemSharesLevel $MemoryShare `
-Confirm:$false
$USERS = $ACOUNTLIST.Split(";")
foreach ($USER in $USERS) {
Get-VM -Name $VMName | New-VIPermission -Role (Get-VIRole -Name "ROLENAME") `
-Principal $USER
}
Get-VM $VMName | New-HardDisk -CapacityGB $CAP `
-StorageFormat EagerZeroedThick `
-Datastore $DATASTORE
Thankyou for your help