Skip to content

Instantly share code, notes, and snippets.

@gcanales75
Last active August 29, 2015 14:25
Show Gist options
  • Select an option

  • Save gcanales75/119117127072cd38e133 to your computer and use it in GitHub Desktop.

Select an option

Save gcanales75/119117127072cd38e133 to your computer and use it in GitHub Desktop.
Ultimas alarmas genradas en vCenter Server
##########################################
## Reporte Alarmas generadas en vCenter ##
##########################################
## Nota 1: Necesita existir previamente la ruta "c:\temp\"
## Nota 2: Unicamente reporta errores y warnings
## Nota 3: Las variables preconfiguradas del script suponen la creacion
## de un reporte con las alarmas de "1" día previo.
$path = "c:\temp\alarmas.csv" ## Ruta para guardar el CSV
$hoy = Get-Date
$diasprevios = "1"
$vC = "vcenter_IP_o_FQDN"
Add-PSSnapin VMware.VimAutomation.Core
Connect-VIServer $vC
Get-VIEvent -start $hoy.adddays(-$diasprevios) -Finish $hoy -Types error, warning | Select @{Name="Fecha/Hora";Expression={$_.createdtime}},
@{Name="Mensaje Warning/Error";Expression={$_.fullformattedmessage}} | Export-Csv $path
Add-Content $path "`r`nReporte generado: $date"
## ¡Abur!
Disconnect-VIServer -Server * -Force -Confirm:$false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment