Skip to main content
Question

Can we use Commvault PowershellSDK Module inside Workflow


Forum|alt.badge.img+6

I have created a powershell script using powershell sdk module to run multiple vm level backups which runs the backup but when i use the same powershelll script inside a workflow it doesnt work for some reason giving me message : I NFO: Get-CVClient: client not found having id [0]. 

 

Is there some limitation or something wrong the way i am passing the scrip inside workflow.

5 replies

Forum|alt.badge.img+6

Can you post the script you are using?


Forum|alt.badge.img+6
  • Author
  • Byte
  • 30 replies
  • October 21, 2023

$string = {xpath:{/workflow/inputs/VM/clientName}}
$string = $string -replace('\[','')
$string = $string -replace('\]','')
$string = $string -replace(' ','')
#$input=$input -replace('[','')
$Servers =$string.Split(",")
$plainText = "dumypassword"
$secureString = ConvertTo-SecureString $plainText -AsPlainText -Force
cd 'E:\CV_Scripts\VSA_Adhoc_Backup\CVPowershellSDK-master'
$Jobs = @()
Connect-CVServer -Server server1 -User testuser -Password $secureString
$(foreach ($i in $Servers)
{
$Job = $null
        $Vm = Get-CVVirtualMachine -Name $($i)
        $pseudoClient = (get-cvclient -id $Vm.pseudoClient.clientId).get_Item("clientName")
        $backupJob = Backup-CVVirtualMachine -Name $Vm.client.clientName -ClientName $pseudoClient
        $Job = [PSCustomObject]@{
                VMName = $Vm.Name
                JobId = $backupJob.jobIds
        }    
        $Jobs += $Job
    })
    $Jobs


Forum|alt.badge.img+6

From what we are seeing the SDK calls are working but they are not able to find the client, hence the error message here:

Get-CVClient: client not found having id [0]

Is is possible to validate that the client information is properly getting into the script?


Forum|alt.badge.img+6
  • Author
  • Byte
  • 30 replies
  • October 22, 2023

The same script is working if I use it directly from powershell but for some reason not working when I use it through workflow. How to validate if the client information is properly getting into script in workflow? Is there something we are missing on the script whi h needs to be added in the script in order to use it in workflow 


Forum|alt.badge.img+6

Is there a way to log or write to a file the client information that get client id is trying to look up?


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings