# list $ProtectionGroups = Get-CohesityProtectionJob | where-object environment -eq kVMware | sort-object Name $ProtectionGroups | Select-Object name, @{n = 'AllowPrefixes'; e = { $_.indexingpolicy.allowprefixes } }, @{n = 'DenyPrefixes'; e = { $_.indexingpolicy.denyprefixes } } | sort-object Name <#ignore program files x2 var #> $indexingPolicy = [PSCustomObject]@{ disableIndexing = $false; allowPrefixes = @('/'); denyPrefixes = @('/$Recycle.Bin','/Windows','/ProgramData','/System Volume Information','/Users/*/AppData','/Recovery','/usr','/sys','/proc','/lib','/grub','/grub2','opt/splunk','/splunk') } #$ProtectionJob = Get-CohesityProtectionJob -Names "DOH-StarLIMS@itdvmvc1" $ProtectionGroups = Get-CohesityProtectionJob | where-object environment -eq kVMware | sort-object Name ForEach ($ProtectionJob in $ProtectionGroups) { If($ProtectionJob.indexingPolicy){ $ProtectionJob.indexingPolicy = $indexingPolicy } Else { $ProtectionJob | Add-Member -MemberType NoteProperty -Name indexingPolicy -Value $indexingPolicy } Set-CohesityProtectionJob -ProtectionJob $ProtectionJob -Confirm:$false }