Share via


Remove-FileLabel

拿掉檔案的敏感度標籤,或根據卷標組態或自定義許可權移除保護。

Syntax

Remove-FileLabel
      [-Path] <String[]>
      [-JustificationMessage <String>]
      [-RemoveLabel]
      [-PreserveFileDetails]
      [<CommonParameters>]
Remove-FileLabel
      [-Path] <String[]>
      [-JustificationMessage <String>]
      [-RemoveLabel]
      [-RemoveProtection]
      [-PreserveFileDetails]
      [<CommonParameters>]
Remove-FileLabel
      [-Path] <String[]>
      [-JustificationMessage <String>]
      [-RemoveProtection]
      [-PreserveFileDetails]
      [<CommonParameters>]

Description

針對 Microsoft Purview 資訊保護 用戶端,Remove-FileLabel Cmdlet 會移除一或多個檔案的敏感度標籤。

範例

範例 1:從檔案中移除卷標

PS C:\> Remove-FileLabel C:\Projects\Analysis.docx -RemoveLabel -JustificationMessage 'The previous label no longer applies'

FileName                   Status Comment
--------                   ------ ------------
C:\Projects\Analysis.docx  Success

此命令會從名為 C:\Projects\Analysis.docx的檔案中移除現有的標籤,並指定強制理由訊息。

需要這個理由方法,因為已啟用相關的敏感度標籤原則設定,以要求移除標籤的理由。

注意

如果您要移除的標籤是使用範本保護檔案,此命令會同時移除標籤和保護。

如果您要移除的標籤是使用自訂許可權保護檔案,此命令只會移除標籤。

範例 8:從檔案移除保護

PS C:\> Remove-FileLabel C:\Projects\Analysis.docx -RemoveProtection

FileName                   Status Comment
--------                   ------ ------------
C:\Projects\Analysis.docx  Success

此命令會從名為 Analysis.docx的單一檔案中移除保護。

範例 9:從檔案移除保護和標籤

PS C:\> Set-AIPFileLabel C:\Projects\Analysis.docx -RemoveProtection -RemoveLabel -JustificationMessage 'The previous label no longer applies'

FileName                   Status Comment
--------                   ------ ------------
C:\Projects\Analysis.docx  Success

此命令會從名為 Analysis.docx的單一檔案中移除標籤和自定義保護。 由於原則設定為需要理由才能移除標籤,因此也會提供理由原因,讓命令可以完成,而不需要提示使用者原因。

參數

-JustificationMessage

如果敏感度標籤原則要求使用者提供這項資訊,移除標籤或移除保護的理由。 如果移除標籤會觸發理由,但未提供此原因,則不會移除標籤。 在此情況下,傳回的狀態為「已略過」並加上「需要理由」的註解。

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Path

指定您要移除標籤和保護資訊的檔案的本機路徑、網路路徑或 SharePoint Server URL。

不支援萬用字元和 WebDav 位置。

針對 SharePoint 路徑,支援下列各項:

  • SharePoint Server 2022
  • SharePoint Server 2019
  • SharePoint Server 2016
  • SharePoint Server 2013

例如:

當您以引弧括住路徑值時,路徑可以包含空格。

Type:String[]
Aliases:FullName, FileName
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-PreserveFileDetails

指定此參數,讓修改日期保留 (Windows 和 SharePoint) ,並針對您標籤的檔案 (SharePoint) 值進行修改:

  • 針對本機或網路檔案, [日期] 修改 的值會保持不變。

  • 針對 SharePoint 檔案,[ 修改日期 ] 和 [修改的值 ] 會保持不變。

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RemoveLabel

拿掉已套用至檔案的任何標籤。

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-RemoveProtection

從檔案移除保護。 如果檔案已加上標籤,則不會移除標籤。

您必須擁有足夠的許可權,或是您組織的進階使用者,才能從檔案中移除保護。 如需詳細資訊,請參閱 設定 Azure Rights Management 和探索服務或數據復原的進階使用者

使用 Remove-FileLabel PowerShell Cmdlet 來啟用從容器檔案移除保護, (zip.rar.7z.pst) 。

注意

  • 此移除保護功能預設為停用,必須先使用 Set-LabelPolicy Cmdlet 來啟用。

  • 對於 .pst 檔案,5 GB 是此 Cmdlet 所支援的最大檔案大小。

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

輸入

System.String[]

輸出

Microsoft.InformationProtection.Powershell.AIP.Results.SetAIPFileResult