Closed antoineboulent closed 3 months ago
Assuming the protection group has run successfully in the past, you could do this:
. .\cohesity-api.ps1
apiauth -vip mycluster -username admin
$jobs = api get -v2 data-protect/protection-groups?names="my mailbox backup"
$search = api get /searchvms?vmName="my mailbox backup"
$objects = @()
$search.vms | ForEach-Object {$objects = @($objects + @{"id" = $_.vmDocument.objectId.entity.id; "name" = $_.vmDocument.objectId.entity.o365Entity.name})}
$jobs.protectionGroups[0].office365Params.objects = $objects
api put -v2 data-protect/protection-groups/$($jobs.protectionGroups[0].id) $jobs.protectionGroups[0]
Hi,
I try bu have an issue, when à run $search = api get /searchvms?vmName="TEST_AUTOPROTECT", $search is empty
It's a requirement that the protection group must have run before. You can not run it on a new test group that has never ben run.
OK I anderstand.
I run the script on the good policy but à have an other issue : "Connected! validation failure list: validation failure list: validation failure list: objects in body shouldn't contain duplicates"
in this autoprotect job, there is ~16 000 mailbox but ~14 500 excluded because there are in static mailbox backup jobs.
try this:
. .\cohesity-api.ps1
apiauth -vip mycluster -username admin
$jobs = api get -v2 data-protect/protection-groups?names="my mailbox backup"
$search = api get /searchvms?vmName="my mailbox backup"
$objects = @()
$objectIds = @($search.vms.vmDocument.objectId.entity.id | Sort-Object -Unique)
$objectIds | ForEach-Object {$objects = @($objects + @{"id" = $_})}
$jobs.protectionGroups[0].office365Params.objects = $objects
api put -v2 data-protect/protection-groups/$($jobs.protectionGroups[0].id) $jobs.protectionGroups[0]
Hi,
I need to convert 365 autoprotect job to an static job but I won't to move object to an new job because the first run will be an full backup and take too time. have you an idea ?
Regards Antoine