Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kevinblumenfeld/5b7803edc724878ae46cca254842a9be to your computer and use it in GitHub Desktop.
Save kevinblumenfeld/5b7803edc724878ae46cca254842a9be to your computer and use it in GitHub Desktop.
$resultArray = @()
$policies = Get-RetentionCompliancePolicy | Select name, guid, comment, type
$labels = Get-RetentionComplianceRule | Select Policy, RetentionComplianceAction, RetentionDuration, Priority, mode, ContentMatchQuery, disabled, @{n = "LabelName"; e = {($_.ComplianceTagProperty).split(",")[1]}}
$policyHash = @{}
foreach ($policy in $policies) {
$policyHash[$policy.guid] = $policy
}
foreach ($label in $labels) {
$labelHash = [ordered]@{}
$labelHash['LabelName'] = $label.LabelName
$labelHash['PolicyName'] = $policyHash[$label.policy].name
$labelHash['RetentionComplianceAction'] = $label.RetentionComplianceAction
$labelHash['RetentionDuration'] = $label.RetentionDuration
$labelHash['Priority'] = $label.Priority
$labelHash['ContentQuery'] = $label.ContentMatchQuery
$labelHash['Mode'] = $label.mode
$labelHash['Disabled'] = $label.Disabled
$resultArray += [psCustomObject]$labelHash
}
$resultArray
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment