Set-DlpKeywordDictionary

此 cmdlet 仅在安全与合规中心 PowerShell 内可用。 有关更多信息,请参见 安全与合规中心 PowerShell

使用 Set-DlpKeywordDictionary cmdlet 在Microsoft Purview 合规门户中修改数据丢失防护 (DLP) 关键字 (keyword) 字典。

有关以下语法部分的参数设置的详细信息,请参阅 Exchange cmdlet 语法

语法

Default (默认值)

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

说明

要在安全与合规中心 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 关键字 (keyword) 字典中名为 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 关键字 (keyword) 字典中,而不影响其他现有术语。

示例 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 关键字 (keyword) 字典中删除指定的术语,而不影响其他现有术语。

示例 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

前三个命令将术语从名为“不当语言”的现有关键字 (keyword) 字典导出到文件 C:\My Documents\InappropriateTerms.txt,其中每个术语位于单独的行中。

使用记事本修改术语并保存文件后,最后四个命令使用 该文件替换 关键字 (keyword) 字典中的术语。

参数

-Confirm

适用:安全 & 合规性

Confirm 开关指定是否显示确认提示。 此开关对 cmdlet 造成的影响取决于在你继续操作之前 cmdlet 是否需要确认。

  • 破坏性 cmdlet(例如 Remove-* cmdlets)内置有暂停,可强制要求先确认命令,然后再继续操作。 对于这些 cmdlet,您可以使用此确切语法跳过确认提示:-Confirm:$false
  • 其他大多数 cmdlet(例如 New-* 和 Set-* cmdlet)都没有内置暂停。 对于这些 cmdlet,指定不含值的 Confirm 开关会引入暂停,从而强制要求你先确认命令,然后再继续操作。

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False
别名:cf

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Description

适用:安全 & 合规性

Description 参数指定 DLP 关键字 (keyword) 字典的描述性文本。 如果值包含空格,则使用引号括住该值。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-DoNotPersistKeywords

适用:安全 & 合规性

{{ Fill DoNotPersistKeywords Description }}

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-FileData

适用:安全 & 合规性

FileData 参数指定 DLP 关键字 (keyword) 字典中使用的术语。 此参数需要以逗号分隔的值列表,这些值以 UTF-16 进行二进制编码。 有关详细信息,请参阅本文中的示例。

压缩后,最大文件大小为 1 MB。 压缩后,所有字典的组织限制也为 1 MB。

参数属性

类型:

Byte[]

默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Identity

适用:安全 & 合规性

Identity 参数指定要修改的 DLP 关键字 (keyword) 字典的名称。 如果值包含空格,则使用引号括住该值。

参数属性

类型:SensitiveInformationTypeIdParameter
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:1
必需:True
来自管道的值:True
来自管道的值(按属性名称):True
来自剩余参数的值:False

-MatchStyle

适用:安全 & 合规性

{{ Fill MatchStyle Description }}

参数属性

类型:String
默认值:None
接受的值:word, string
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Name

适用:安全 & 合规性

Name 参数指定 DLP 关键字 (keyword) 字典的唯一名称。 如果值包含空格,则使用引号括住该值。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-WhatIf

适用:安全 & 合规性

WhatIf 开关在安全与合规 PowerShell 中不起作用。

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False
别名:无线

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

CommonParameters

此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters