VMware Cloud Community
akioichiban23
Contributor
Contributor

Auto-Deploy

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

Reply
0 Kudos
1 Reply
LucD
Leadership
Leadership

When you can't change the AlarmDefinition temporarily, I honestly see no way to avoid the alarm actions (sending an email).

The Alarm is acting like you defined it to act.

When you can change the action to Once (temporarily), the multiple emails could be avoided.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos