Hi Angel,
Thanks a lot for your export/import alarms script. I am novice in PowerShell/Powercli.
In your script you are exporting an alarm based on its name. But, I would like to export all the alarms that are defined on vCenter (only). So, I tried executing the code below.
functionExportAlarm(){
Connect-VIServer$serverToExportFrom-User'XXXXX'-Password'XXXXX'
$alarmToExport=Get-AlarmDefinition-Entity (Get-Folder-NoRecursion)
foreach ($alarmin$alarmToExport)
{
$a=Get-View-Id$alarm.Id
$xml+=$a.Info
}
$xml|Export-Clixml-Path$fileName-Depth ( [System.Int32]::MaxValue )
}
But Iam getting an error like:
Could you please give your suggestion on how to collect all the alarms data in to xml file rather than just a single alarm.
One more query:
$alarmToExport=Get-AlarmDefinition-Entity (Get-Folder-NoRecursion)
By using the above command, we are collecting the alarms which are created on Vcenter object/level only, but not on any other objects like datacenter,VMs e.t.c.Please correct me if I am wrong.
Thanks in advance.