Solved

REST API call for PowerShell command Get-CVVirtualMachine

  • 1 September 2022
  • 3 replies
  • 99 views

Badge +3

What can replace the "Get-CVVirtualMachine" PowerShell command in the Commvault REST API?

I use the "Get-CVVirtualMachine -Protected" command to get a list of virtual machines that are being backed up so that I can start a restore.

Looked at the API page on my Commvault server (https://CommvaultSRV/webconsole/sandbox/apiexplorer/#/Virtualization%20Operations) and I couldn't identify any GET command that would give me the same result as the PowerShell command.

 

Does anyone have any idea how to get a list of all protected VMs from Commvault REST API?

icon

Best answer by VladimirP 1 September 2022, 16:51

View original

3 replies

Badge +3

I found solution to list VMs in this post:

https://community.commvault.com/commvault-q-a-2/api-call-to-get-information-about-vms-which-are-present-in-vmgroup-3034 

Can I consider that "slaCategoryDescription = Protected" is the same filter as in PowerShell command "Get-CVVirtualMachine -Protected"?

Badge +3

In case somebody has the same question, I checked and "slaCategoryDescription=Protected" is not actually the same as "Get-CVVirtualMachine -Protected".

I had two VMs in backup, then I deleted one VM from Commvault, but the "Get-CVVirtualMachine -Protected" command returned that I have two protected VMs (assuming because the backup hasn't expired).

When I checked "slaCategoryDescription" I saw that the existing VM has "slaCategoryDescription=Protected" but deleted VM has "slaCategoryDescription=Deconfigured".

Userlevel 7
Badge +19

@VladimirP thanks for sharing! so it's quite confusing ;-s based on your finding I would say slaCategoryDescription should be renamed into something like vmBackupState. you b.t.w. might consider looking if there is a v4 API call to create the list as it might output the information differently. 

Reply