You can create a simple report containing information about the virtual machines associated with all protection groups.

Prerequisites

  • Verify that you are connected to a vCenter Server system.
  • Verify that you are connected to an SRM server.

Procedure

  1. List all protection groups associated with the SRM server.
    $srmApi = $srmConnection.ExtensionData
    $protectionGroups = $srmApi.Protection.ListProtectionGroups()
  2. Generate a report of the virtual machines associated with all protection groups.
    $protectionGroups | % {
        $protectionGroup = $_
        
        $protectionGroupInfo = $protectionGroup.GetInfo()
        
        # The following command lists the virtual machines associated with a protection group
        $vms = $protectionGroup.ListAssociatedVms()
        # The result of the above call is an array of references to the virtual machines at the vSphere API
        # To populate the data from the vSphere connection, call the UpdateViewData method on each virtual machine view object
        $vms | % { $_.UpdateViewData() }
        # After the data is populated, use it to generate a report
        $vms | %{
            $output = "" | select VmName, PgName
            $output.VmName = $_.Name
            $output.PgName = $protectionGroupInfo.Name
            $output
        }
    } | Format-Table @{Label="VM Name"; Expression={$_.VmName} }, @{Label="Protection group name"; Expression={$_.PgName} }