The recent (v22) release of VMware Cloud Disaster Recovery introduces a new RESTful API for monitoring and retrieving information about protected VMs, protected sites, protection groups, snapshots, cloud file systems, and recovery SDDCs.
With this new API, we are going to introduce a new set of PowerShell cmdlets to monitor VMware Cloud Disaster Recovery (VCDR).
Special thanks to Max Daneri for putting this content together for sharing here.
- Establishes a connection to a VCDR Server system
- Closes the connection to a VCDR Server system
- List any cloud file systems (SCFS)
- List any protected sites
- List any protection groups (PGs) associated with an individual cloud file system
- List any snapshots in a specific protection group
- List of any protected VM associated with an individual cloud file system
- List any Recovery SDDC
Let’s take a look at each of these cmdlets and how they can be used to gather information about your VCDR instances.
Getting a token
The first step to getting access to VCDR is to get a VMC Refresh Token. If you already have one you can skip the next topic
VCDR is a VMware Cloud Service and like any other service is using a user Refresh Token to authenticate.
This can be done in 3 simple steps:
1) Login to your VMC Console https://vmc.vmware.com
2) Go to API Tokens – > GENERATE TOKEN
- You can set the Token TTL as much as you like
- Select at least Organization Role of Organization Member
- Select the Service Role VMware Cloud DR
- Note: The VMware Cloud DR Admin requirement will be dropped in a future release for a simple Auditor role.
3) Hit Generate and Save your token as this cannot be retrieved again.
Import the Cmdlets
Open your PowerShell tool and install the VMware.VCDRService module:
- You can use PowerShell Core (Any OS) v7.1.x or greater or PowerShell Desktop (Windows) v5.1 or greater.
- You can open your PowerShell command line pwsh for .net core or PowerShell for Desktop Windows version
PS> Install-Module -Name VMware.VCDRService
Connect to VMware Cloud DR service
The first CmdLets to use is Connect-VCDRServer using the VCDR URL for the Orchestrator and the API refresh token previously generated.
PS> Connect-VCDRServer -server "<your_VCDR_FQDN>" -token "<yourToken>"
- NOTE: each cmdlet has a "-server" property where the variable can be used when multiple VCDR Servers are connected.
The Connect-VCDRServer result can be assigned to a variable and used as a parameter when more than one VCDR service is available. For example, you can connect to multiple VCDRs available in different Regions and use the variable filled by Connect-VCDRServer to select a specific VCDR instance.
Explore the Cmdlets
The following command is Get-VCDRCloudFileSystem. This cmdlet returns a list of all Cloud File Systems deployed in a specific region or, more precisely, all SCFS associated managed by the VCDR Orchestrator you are using.
In this case, we have two Cloud File Systems.
Usually is convenient to assign the result of this Cmdlet to a variable so can be used as a parameter for other Cmdlets.
For example, using the $cloudFileSystem variable(array) I can invoke Get-VCDRProtectedSite with the first entry 
In this case, the response is the list of any Protected Site covered by cloud-backup-2-GSS Cloud File System.
NOTE: The -CloudFileSystem parameter can also be passed through a pipeline in this case $cloudFileSystem|Get-VCDRProtectedSite.
Using the same $cloudFileSystem variable you can get the list of Protection Groups associated with the other Cloud File System at entry  cloud-backup-1-TS including health state and used space
NOTE: The -CloudFileSystem parameter can be an array of CloudFileSystem and the result will be the sum of the result of each CloudFileSystem.
Here is a sample script that can give you all the available information regarding your VMware Cloud Disaster Recovery configuration:
# set environment and local values for your site Install-Module -Name VMware.VCDRService $token="your Generated VMC API token" $server="vcdr-aaa-bbb-ccc-ddd.app.vcdr.vmware.com" # connect to VMware Cloud DR instance $VCDR=Connect-VCDRServer -server $server -token $token # identify any deployed SDDC(s) $RecoverySDDC=Get-VCDRRecoverySDDC #identify the connected SCFS repositories $SCFS=Get-VCDRCloudFileSystem #return any Protection Site(s) for the first CloudFileSystem returned $ProtectedSites=Get-VCDRProtectedSite -CloudFileSystem $SCFS #return any Protection Group(s) for the first CloudFileSystem returned $PGs=Get-VCDRProtectionGroup -CloudFileSystem $SCFS #return any snapshots for the list of PGs (Protection Groups) returned $Snapshots=Get-VCDRSnapshot -ProtectionGroups $PGs # identify the VMs protected for the first CloudFileSystem identified $VMs=Get-VCDRProtectedVm -CloudFileSystem $SCFS # cleanly exit Disconnect-VCDRServer -server $VCDR
PowerCLI for VMware Cloud Disaster Recovery brings us the ability to view helpful information and the status of different VCDR components. This is the first release of VCDR that includes an API. The RESTful API are not mature yet, and the same is true for the PowerCLI, today are not officially supported but we are committed to improving and expanding both API and Cmdlets to cover any feature today available in VCDR.