Hi @benjaminas , thanks for the post!
I don’t have one (though @chrisknows might), though I did find this:
Using Script APIs for Workflows:
https://documentation.commvault.com/2022e/essential/132463_script_apis_for_workflows.html
REST API to assign the schedule policy:
https://documentation.commvault.com/2022e/essential/48846_rest_api_post_schedule_policy_add_agent.html
This should enable you to use this API in a Workflow and get what you need.
Hi @benjaminas , thanks for the post!
I don’t have one (though @chrisknows might), though I did find this:
Using Script APIs for Workflows:
https://documentation.commvault.com/2022e/essential/132463_script_apis_for_workflows.html
REST API to assign the schedule policy:
https://documentation.commvault.com/2022e/essential/48846_rest_api_post_schedule_policy_add_agent.html
This should enable you to use this API in a Workflow and get what you need.
@Mike Struening , is a little off here :(
The second link refers to modifying the agent associations so I don’t think it’s what @benjaminas needs.
The api/xml you need is https://documentation.commvault.com/11.24/essential/48857_rest_api_put_schedule_policy.html
or https://documentation.commvault.com/11.24/essential/48911_update_schedule_policy_entity_associations_rest_api_put.html
The latter looks to be the exact same xml file with the non-association changes removed.
Regardless of the method you use; rest call, or qoperation execute it would require the use of the same xml file that is noted in the link above.
The two things you would need are are follows:
- The name of the schedule policy that you want to change.
- An identifier for the entity you want to change, i.e You have to be specific regarding what you are associating to the policy.
The result would look something like this :
<?xml version="1.0" encoding="utf-8" ?>
<TMMsg_ModifyTaskReq>
<taskInfo>
<taskOperation>MODIFY</taskOperation>
<task>
<taskName></taskName>
<taskType>SCHEDULE_POLICY</taskType>
</task>
<associations clientName="myClient1" appName="SQL Server" backupsetName="DefaultBackupSet" />
<associations clientName="myClient1" appName="SQL Server" backupsetName="DefaultBackupSet" subclientName="Default Subclient"/>
</associations>
</taskInfo>
</TMMsg_ModifyTaskReq>
Please note that you would have to update the entire client associations list every time you do this. This means that you should be very careful when doing this.
Unfortunately I do not have a workflow already on-hand for this, though it would not take long to whip up. The approach I have taken is associating schedule policies with groups and then modifying the groups. This has the fortunate side effect being able to add or remove clients from schedule policies very easily.
I knew you’d know better, @christopherlecky !
I used the attached workflow in v10 to set the schedule policy for the File System Agent. It is using
qmodify schedulepolicy -o add -c clientName -scp <schedule policy name> for all clients in a given client computer group.
It will require some modifications to work with v11