Reply to Message

View discussion in a popup

Replying to:
jaychinut
Contributor
Contributor

VMware SDK for SRM - PlanId Query

Dear VMware community

I am currently exploring the VMware.Sdk.srm module to interact with the SRM REST API for a project involving disaster recovery and business continuity. While navigating this process, I have encountered a question regarding the retrieval of the 'PlanId' value and the overall usage of this parameter in my scripting efforts.

To provide context, I have outlined the steps I have taken so far:

1. I initiate my script by obtaining the pairing ID with the command:
```powershell
$pairings = Invoke-SrmGetPairings
```

2. Following this, I compile a list of recovery plans associated with the obtained pairing ID:
```powershell
$plans = Invoke-SrmGetAllRecoveryPlans -pairingId $pairings.List.pairingid.guid
```

3. From the list of recovery plans, I extract relevant information from a plan named 'PlanName1' using the following line of code:
```powershell
$planid = $plans.list | Where-Object { $_.Name -eq "PlanName1" }
```

4. My intention is to use the 'PlanId' I've gathered in the previous step to retrieve recovery steps for this particular plan. However, when executing the following command, I encounter an error:
```powershell
Invoke-SrmGetRecoverySteps -PairingId $pairings.List.pairingid.guid -PlanId $planid.Id -ViewMode test
The error looks like this: Invoke-SrmGetRecoverySteps: Error converting value {null} to type 'System.Int64'. Path 'list[0].start_time', line 1, position 213.
```


To clarify my query further, when I inspect the `$planid` variable, it provides the following details:

```powershell
Status : READYSTATE
Id : DrRecoveryRecoveryPlan:9fzzzzz-23zz-48zz-b2zz-bzzzzzzzzzz:4zzzzzzzz-7zzz-4zzz-9fzz-b7zzzzzzzzz
ProtectedSiteName : vcenter1
RecoverySiteName : vcenter2
ProtectedVcGuid : 80zzzzz-95zz-4zzz-9zzzz-f4zzzzzzzz
RecoveryVcGuid : 89zzzzz-69zz-4bzz-97zz-5zzzzzzzz
Name : RecoveryPlan1
Description :
Location : DrFolder:DrRecoveryRootFolder:442zzzzz-77zz-46zz-9fzz-bzzzzzzzz
LocationName : Recovery Plans
Progress : 0
IsRunning : False
```

In summary, I would greatly appreciate your assistance in clarifying whether the 'Id' property within the `$planid` variable contains the 'PlanId' I should be using in the `Invoke-SrmGetRecoverySteps` command.

Reply
0 Kudos