获取 DLPComplianceRule returns System.Collections.Hashtable
Get-DLPComplianceRule returns System.Collections.Hashtable
我正在使用 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"}]
,
不要将其转换为 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
@codesniffer 设置多个组,你可以像这样使用。
-ContentContainsSensitiveInformation @{operator = "Or"; groups = @(@{name = "Group1"; operator = "And"; sensitivetypes = @(@{Name = "Rule1"; minconfidence = "80" ; minCount = "1" }, @{Name = "Rule2"; minconfidence = "85" ; minCount = "1" }) }; @{name = "Group2"; operator = "And"; sensitivetypes = @(@{Name = "Rule3"; minconfidence = "80" ; minCount = "1" }) }) }
我正在使用 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"}]
,
不要将其转换为 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
@codesniffer 设置多个组,你可以像这样使用。
-ContentContainsSensitiveInformation @{operator = "Or"; groups = @(@{name = "Group1"; operator = "And"; sensitivetypes = @(@{Name = "Rule1"; minconfidence = "80" ; minCount = "1" }, @{Name = "Rule2"; minconfidence = "85" ; minCount = "1" }) }; @{name = "Group2"; operator = "And"; sensitivetypes = @(@{Name = "Rule3"; minconfidence = "80" ; minCount = "1" }) }) }