Set-DlpKeywordDictionary

此 Cmdlet 僅適用於安全性與合規性 PowerShell。 如需詳細資訊,請參閱 安全性與合規性 PowerShell。

使用 Set-DlpKeywordDictionary Cmdlet 修改Microsoft Purview 合規性入口網站中的資料外洩防護 (DLP) 關鍵字字典。

如需下方<語法>一節中參數集的詳細資訊,請參閱 Exchange Cmdlet 語法。

語法

Default (預設值)

Set-DlpKeywordDictionary
    [-Identity] <SensitiveInformationTypeIdParameter>
    [-Confirm]
    [-Description <String>]
    [-DoNotPersistKeywords]
    [-FileData <Byte[]>]
    [-MatchStyle <String>]
    [-Name <String>]
    [-WhatIf]
    [<CommonParameters>]

Description

若要在安全性與合規性 PowerShell 中使用此 Cmdlet,您必須獲得指派權限。 如需詳細資訊,請參閱 Microsoft Purview 合規性入口網站中的權限。

範例

範例 1

$Keywords = "Aarskog's syndrome, Abandonment, Abasia, Abderhalden-Kaufmann-Lignac, Abdominalgia, Abduction contracture, Abetalipo proteinemia, Abiotrophy, Ablatio, ablation, Ablepharia, Abocclusion, Abolition, Aborter, Abortion, Abortus, Aboulomania, Abrami's disease, Abramo"

$EncodedKeywords = [System.Text.Encoding]::Unicode.GetBytes($keywords)

Set-DlpKeywordDictionary -Identity "Diseases" -FileData $EncodedKeywords

此範例會以指定的值取代 DLP 關鍵字字典中名為 Diseases 的現有字詞。

範例 2

$Dictionary = Get-DlpKeywordDictionary -Name "Diseases"

$Terms = $Dictionary.KeywordDictionary.split(',').trim()

$Terms += "Achylia","Acidemia","Acidocytopenia","Acidocytosis","Acidopenia","Acidosis","Aciduria","Acladiosis","Aclasis"

$Keywords = $Terms -Join ", "

$EncodedKeywords = [System.Text.Encoding]::Unicode.GetBytes($Keywords)

Set-DlpKeywordDictionary -Identity "Diseases" -FileData $EncodedKeywords

此範例會將指定的字詞新增至名為 Diseases 的 DLP 關鍵字字典,而不會影響其他現有字詞。

範例 3

$Dictionary = Get-DlpKeywordDictionary -Name "Diseases"

$Terms = $Dictionary.KeywordDictionary.split(',').trim()

$TermsToRemove = @('abandonment', 'ablatio')

$UpdatedTerms = $Terms | Where-Object {$_ -NotIn $TermsToRemove}

$Keywords = $UpdatedTerms -Join ", "

$EncodedKeywords = [System.Text.Encoding]::Unicode.GetBytes($Keywords)

Set-DlpKeywordDictionary -Identity "Diseases" -FileData $EncodedKeywords

此範例會從名為 Diseases 的 DLP 關鍵字字典中移除指定的字詞,而不會影響其他現有的字詞。

範例 4

$Dictionary = Get-DlpKeywordDictionary -Name "Inappropriate Language"

$Terms = $Dictionary.KeywordDictionary.split(',').trim()

Set-Content $Terms -Path "C:\My Documents\InappropriateTerms.txt"

$UpdatedTerms = Get-Content -Path "C:\My Documents\InappropriateTerms.txt"

$Keywords = $UpdatedTerms -Join ", "

$EncodedKeywords = [System.Text.Encoding]::Unicode.GetBytes($Keywords)

Set-DlpKeywordDictionary -Identity "Inappropriate Language" -FileData $EncodedKeywords

前三個命令會將名為「不適當語言」的現有關鍵字字典中的字詞匯出至檔案 C:\My Documents\InappropriateTerms.txt,其中每個字詞都位於不同的行中。

使用記事本修改字詞並儲存檔案之後,最後四個命令會使用檔案取代關鍵字字典中的字詞。

參數

-Confirm

適用對象:安全性 & 合規性

Confirm 參數會指定要顯示或隱藏確認提示。 此參數對 Cmdlet 的影響取決於 Cmdlet 是否需要確認才能繼續。

  • 破壞性的 Cmdlet (如 Remove-* cmdlets) 有內建暫停,它會先強迫您確認命令才會繼續作業。 對於這些 Cmdlet,您可以使用以下確切語法來略過確認提示:-Confirm:$false。
  • 其他大部分的 Cmdlet (如 New-* 和 Set-* cmdlets) 則沒有內建暫停。 針對這些 Cmdlet,指定不帶值的 Confirm 參數會造成暫停,強制您在繼續之前先確認命令。

參數屬性

類型:SwitchParameter
預設值:None
支援萬用字元:False
不要顯示:False
別名:CF

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-Description

適用對象:安全性 & 合規性

Description 參數會指定 DLP 關鍵字字典的描述文字。 如果值包含空格,請使用引號括住值。

參數屬性

類型:String
預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-DoNotPersistKeywords

適用對象:安全性 & 合規性

{{ Fill DoNotPersistKeywords 描述 }}

參數屬性

類型:SwitchParameter
預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-FileData

適用對象:安全性 & 合規性

FileData 參數會指定 DLP 關鍵字字典中使用的字詞。 這個參數需要以逗號分隔、以 UTF-16 二進位編碼的值清單。 如需詳細資訊,請參閱本文中的範例。

壓縮後的檔案大小上限為 1 MB。 所有字典的組織限制也是壓縮後 1 MB。

參數屬性

類型:

Byte[]

預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-Identity

適用對象:安全性 & 合規性

Identity 參數會指定您要修改的 DLP 關鍵字字典名稱。 如果值包含空格,請使用引號括住值。

參數屬性

類型:SensitiveInformationTypeIdParameter
預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:1
必要:True
來自管線的值:True
來自管線按屬性名稱的值:True
來自剩餘引數的值:False

-MatchStyle

適用對象:安全性 & 合規性

{{ 填滿 MatchStyle 描述 }}

參數屬性

類型:String
預設值:None
接受的值:word, string
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-Name

適用對象:安全性 & 合規性

Name 參數會指定 DLP 關鍵字字典的唯一名稱。 如果值包含空格,請使用引號括住值。

參數屬性

類型:String
預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-WhatIf

適用對象:安全性 & 合規性

WhatIf 開關無法在安全性與合規性 PowerShell 中使用。

參數屬性

類型:SwitchParameter
預設值:None
支援萬用字元:False
不要顯示:False
別名:WI

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

CommonParameters

此 Cmdlet 支援常見參數: -Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 如需詳細資訊,請參閱 about_CommonParameters。