Get-DLPComplianceRule возвращает System.Collections.Hashtable - PullRequest
0 голосов
/ 07 августа 2020

Я использую Get-DLPComplianceRule и пытаюсь прочитать параметр «ContentContainsSensitiveInformation», но получаю «System.Collections.Hashtable» вместо фактического сохраненного значения. Ниже приведен фрагмент кода.

$jComplianceRule= Get-DLPComplianceRule -Policy "Finance Rule" | ConvertTo-Json
Write-Host $jComplianceRule | ConvertFrom-Json

"ContentContainsSensitiveInformation":  [
{"groups":  "System.Collections.Hashtable System.Collections.Hashtable",                                                    "operator":  "And"}]

,

1 Ответ

0 голосов
/ 10 августа 2020

Не конвертируйте его в Json и используйте следующий скрипт для получения ContentContainsSensitiveInformation, определенного в группах.

$jComplianceRule= Get-DLPComplianceRule -Policy "Finance Rule"

$SensitiveInformation = ""

foreach ($group in $jComplianceRule[0].ContentContainsSensitiveInformation[0].groups){
    $SensitiveInformation += $group.sensitivetypes | ConvertTo-Json
}

Write-Host $SensitiveInformation
...