Question

Script to add VMs to Subclient

  • 10 February 2023
  • 4 replies
  • 77 views

Badge +2

Hello everyone,

I am looking for a script to add Vmware VMs to subclient.  I have been poking around Powershell SDK/Commands but i am not successful so far with the latest Powershell v32 SDK

 

Eventually i need to feed VM Names from csv file and loop through but for now just testing with a single VM. 

Add-CVVirtualMachine -ClientName myVCenter -SubclientName z_Subclient_0400PM -EntityType VM -Entity my-vmname

 

Getting following error: 

“Get-CVVirtualMachine : A parameter cannot be found that matches parameter name 'Name'.
At C:\Program Files\WindowsPowerShell\Modules\CommvaultPowerShell\0.2.11\custom\oldsdk\Add-CVVirtualMachine.ps1:166 char:61
+ ...                         $vmProps = Get-CVVirtualMachine -Name $entity ...
+                                                             ~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-CVVirtualMachine], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Get-CVVirtualMachine 

 

Thanks,

 


4 replies

Badge

Thank you for reporting this error.

We will fix this soon.

This cmdlet is available in the old SDK : https://github.com/Commvault/CVPowershellSDK as well.

You can uninstall the existing version and install through this github which will work for your requirement for now.  

Badge +2

thank you! problem is that, the old sdk works for a single VM but fails to add multiple VM in the list well. 

 

Add-CVVirtualMachine -ClientName myVCenter -SubclientName z_Subclient_0400PM -EntityType VM -Entity my-vmname, my_vmname2, my_vmname3

 

Any ETA when will get it fixed? 

 

Thank you!

Badge +2

@JnaneshD do you know if this is fixed in 0.2.13 ? 

Badge

Hi @Just Learning , 

It is not been fixed yet. We will work on this and update.

Thanks

Reply