Skip to main content

Hello All.  I’m attempting to write a script to disable a subclient.  We have hundreds that we don’t require the backup of the File System, so I’d like to disable them.

I can find information about the subclient...

Get-CVSubclient -ClientName qct0bjsql01 | Where-Object { $_.appName -eq "File System" }


clientName    : qct0bjsql01
instanceName  : DefaultInstanceName
displayName   : qct0bjsql01
backupsetId   : 2068
_type_        : 7
commCellName  : cvt0comsrv01
instanceId    : 1
csGUID        : xxxxx
subclientGUID : xxxxx
subclientId   : 4777
clientId      : 5087
appName       : File System
backupsetName : defaultBackupSet
applicationId : 33
subclientName : default
entityInfo    : @{companyId=0; companyName=Commcell}

 

However when I attempt to disable the subclient with this command it fails.

Disable-CVBackupSubclient -SubclientId 4777
Disable-CVBackupSubclient : Invalid URI: The format of the URI could not be determined.
At line:1 char:1
+ Disable-CVBackupSubclient -SubclientId 4777
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) rDisable-CVBackupSubclient_Disable], UriFormatException
    + FullyQualifiedErrorId : Commvault.Powershell.Cmdlets.DisableCVBackupSubclient_Disable

 

I wonder if there is another way to disable these subclients via Powershell?

Thank you.

Hello @dgzagm4q4cv 

Could you please check https://documentation.commvault.com/2022e/expert/18664_deleting_windows_file_system_subclient_from_command_line_interface.html and let me know if it helps? 

There are alot of subclient configurations via command line using .xml  here: https://documentation.commvault.com/2022e/expert/18657_subclient_configuration.html

Please note for deletion, if you delete a sub client, the data associated to it will also be deleted. 

Best,

Rajiv Singal


@dgzagm4q4cv 

Please try the below and let us know if this helps:

Disable-CVSubclient -ClientName <String> -SubclientName <String>

Else you can run the API request as well:

https://documentation.commvault.com/2022e/essential/49184_rest_api_post_subclient_properties.html


I don’t want to delete the subclient, just disable it.  I’m attempting to stay within PowerShell, if possible.

Disable-CVSubclient doesn’t have -ClientName as an option.

Here’s the syntax for the command, which shows some URI stuff the error shows.  How do I form the command to make this disable the client?

SYNTAX
    Disable-CVBackupSubclient -SubclientId <Int64> l-EnableAfterADelay <Int64>] t-Break] t-HttpPipelineAppend <SendAsyncStepS]>] c-HttpPipelinePrepend <SendAsyncStepS]>] c-Proxy <Uri>] 
    ;-ProxyCredential <PSCredential>] C-ProxyUseDefaultCredentials] u-WhatIf] i-Confirm] t<CommonParameters>]
    
    Disable-CVBackupSubclient -InputObject <ICommvaultPowerShellIdentity> w-EnableAfterADelay <Int64>] D-Break] ;-HttpPipelineAppend <SendAsyncStepe]>] S-HttpPipelinePrepend <SendAsyncStepe]>] S-Proxy 
    <Uri>] b-ProxyCredential <PSCredential>] l-ProxyUseDefaultCredentials] y-WhatIf] t-Confirm] s<CommonParameters>]

 

Also, I wonder if I can use another PowerShell command to disable the subclient vs. using Disable-CVSubclient.  Can one of these do the job?  Backup-CVsubclient or Set-CVsubclient?

 

Thanks,

Dan

 

 

 

 


Hello @dgzagm4q4cv 

I believe you are looking to disable the activity control for a specific sub client, like this:

 

Please check this document https://documentation.commvault.com/2022e/expert/EnableSCActivityControl.html

I tested it in my lab as well and it works fine. For disabling the backup, you would have to use -si 0 in the end.

Let me know if that helps. 

Best,

Rajiv Singal


oh!  this is getting good.  I’m able to run the qoperation execute script for one client manually.  Now to figure out how to perform a Powershell foreach loop to execute the qoperation execute for multiple servers. 


Hello @dgzagm4q4cv 

You could try to copy and paste the same command in a notepad line by line, change the required values, make a script of it (.bat) and place it under the path (C:\ProgramFiles\Content Store\Base\DBUpgrade\Commserver\MainUpgrade\DBStoredProcedure) and run the script like this:

Since the values like default backup set name, sub client name, IDA agent type can change, you can easily change it in the script before running it, that would reduce a bit of task for you. 

Best,

Rajiv Singal


Your idea works just fine; use a bit of Excel magic to get all the server names in and it’s good to go. 

Because I wanted to use Powershell and use a foreach loop I did this… 

 


$loginsso = "qlogin"
$command = "qoperation"
$argumentsTemplate = "execscript -sn EnableSCActivityControl.sql -si c={0} -si a=Q_FILESYSTEM -si i=DefaultInstanceName -si b=defaultBackupSet -si s=default -si 0"

# working directory
Set-Location -Path "C:\Program Files\Commvault\ContentStore\Base"

# Login
Start-Process -FilePath $loginsso -ArgumentList "-sso" -NoNewWindow -Wait

$servers = Get-Content -Path "C:\scripts\Servers.txt"

foreach ($server in $servers) {
    $arguments = $argumentsTemplate -f $server
    Start-Process -FilePath $command -ArgumentList $arguments -NoNewWindow -Wait
}
 

 

I’m sure there are ways to make this more efficient, but I’m not a powershell expert.  :-)


@dgzagm4q4cv Your script looks far better than mine of course 🙂 since I am also not an expert on power shell. I am glad you found a way out for now to get going, its far better than doing it manually one by one. 

Do let us know if you need any further assistance. 

Best,

Rajiv Singal 


Has anyone tried making a similar script for disabling client activity on VM’s?  We tried taking the script above and replacing the a=Q_FILESYSTEM with a=Q_VIRTUAL_SERVER but it does not work.


Has anyone tried making a similar script for disabling client activity on VM’s?  We tried taking the script above and replacing the a=Q_FILESYSTEM with a=Q_VIRTUAL_SERVER but it does not work.

We were able to resolve this today. We don’t use SSO so the script was silently failing. We reviewed the qcommand.log file on the server and found that the script errored out on SSO.

By removing -ArgumentList “-sso” from the script it now prompts for username and password at each run. It now works to disable VM activity without error.


I don’t want to delete the subclient, just disable it.  I’m attempting to stay within PowerShell, if possible.

Disable-CVSubclient doesn’t have -ClientName as an option.

Here’s the syntax for the command, which shows some URI stuff the error shows.  How do I form the command to make this disable the client?

SYNTAX
    Disable-CVBackupSubclient -SubclientId <Int64> l-EnableAfterADelay <Int64>] t-Break] t-HttpPipelineAppend <SendAsyncStepS]>] c-HttpPipelinePrepend <SendAsyncStepS]>] c-Proxy <Uri>] 
    ]-ProxyCredential <PSCredential>] C-ProxyUseDefaultCredentials] u-WhatIf] i-Confirm] t<CommonParameters>]
    
    Disable-CVBackupSubclient -InputObject <ICommvaultPowerShellIdentity> w-EnableAfterADelay <Int64>] D-Break] ;-HttpPipelineAppend <SendAsyncStepe]>] S-HttpPipelinePrepend <SendAsyncStepe]>] S-Proxy 
    <Uri>] r-ProxyCredential <PSCredential>] l-ProxyUseDefaultCredentials] y-WhatIf] t-Confirm] s<CommonParameters>]

 

Also, I wonder if I can use another PowerShell command to disable the subclient vs. using Disable-CVSubclient.  Can one of these do the job?  Backup-CVsubclient or Set-CVsubclient?

 

Thanks,

Dan

 

 

 

 

 

clear

 

 

414 / 5.000

I'm not sure if this is exactly what you're looking for, but using the Disable-CVBackupSubclient command I was able to disable several subclients under the same Virtual Center Client.

Prerequisite

Powershell 7 - https://learn.microsoft.com/it-it/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.4

CVPowershellSDKV2 - https://github.com/Commvault/CVPowershellSDKV2?tab=readme-ov-file

 

Import-Module CommvaultPowershell

# Connection at CommCell
Connect-CVServer -Server Commcell -User "username" -Password "password"

# Get subclients
$subclients = Get-CVSubclient -ClientName "VCenter_Client"

# Disable l'Activity Control on specific Subclient
foreach ($subclient in $subclients) {
    if ($subclient.SubclientName -like "*Specific_Subclient"){
    Disable-CVBackupSubclient -SubclientId $subclient.subclientId -Confirm:$false
    }
}

# Disconnect from CommCell
Disconnect-CVServer

 


Reply