Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 225804

Re: Script to export/import Alarms between VC or synchronize alarms between 2 Virtual Centers

$
0
0

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:

Capture.PNG

 

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.


Viewing all articles
Browse latest Browse all 225804

Trending Articles