hi guys I have the following scrip I want that after the sentence "ELSE" is sent a notification email as I can do it?
----------------------------------------------------------------------------------------------------------------------------------------------------
##Sentencia para verificacion de conexion a VM origen
while($TRUE){
if (Test-Connection -ComputerName $VMIP -Delay 1 -quiet){
Write-Host "$VMIP is up" -ForegroundColor Green
}
else{
Write-Host "$VMIP is down" -ForegroundColor Green
##Coneccion a vCenter
connect-viserver -server $vcenter_server -User $vcenter_user -Password $vcenter_pwd
#Nombre de la VM Origen
$VMorigen= "SRV-SIPSERVER"
#Nombre de la ultima VM clonada
$VMclone= "$($VMorigen)-$((Get-Date).ToString('MMddyyyy'))"
Get-VM -Name SRV-SIPSERVER | Get-NetworkAdapter | Set-NetworkAdapter -Connected:$false -Confirm:$false
GET-VM -Name $VMclone | Start-VM -Confirm:$False
##Desconnexion de vCenter
Disconnect-VIServer -Confirm:$false
##Para sentencia en caso de no tener conexion
break
}
}