Last active
August 29, 2015 14:25
-
-
Save gcanales75/119117127072cd38e133 to your computer and use it in GitHub Desktop.
Ultimas alarmas genradas en vCenter Server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ########################################## | |
| ## 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