List ALL VMware SRM Protected VMs with their Protection Group Names

In your VMware Site-Recovery-Manager Environment, you may need to fetch the list of protected VMs and their associated protection group for documentation purpose. For this purpose, I created this one-liner command to fetch the necessary information with Name, Protection Group Name, Description, Replication Type & Datastore.
1) You will need to install VMware PowerCLI modules. As of now, the latest version is 6.5R1 (Download Here). But I tested with version 6.3R1 (Download here). (Note that SRM is supported from PowerCLI version 5.5R2 & later).

2) Open the VMware vSphere PowerCLI from Start menu. Connect to vCenter Server. It will prompt you for vCenter server credentials.
Connect-ViServer -Server MyvCenterServerNameOrIP -Credential (Get-Credential)

3) Connect to SRM server by the following command. It will prompt you for SRM server credential. It usually is the same as vCenter server Admin’s credentials.
$srm = Connect-SrmServer -RemoteCredential (Get-Credential)

4) Type or Paste the following command in console. If you want to export to CSV file which you can open with Excel later, skip this step & go to step 4.

5) You can export the output to CSV file by the following command.

6) (optional) You can disconnect the SRM connection & vCenter server by the following 2 commands.
Disconnect-SrmServer -Confirm:$false
Disconnect-ViServer -Confirm:$false

Leave a Reply

Your email address will not be published. Required fields are marked *