Commands › Exchange Online

Set-SensitiveInformationScan

Exchange Online ExchangeOnlineManagement Set-*

For more information, see Security & Compliance PowerShell. Use the Set-SensitiveInformationScan cmdlet to modify on-demand classification scans.

Quick start script

# Set-SensitiveInformationScan — quick start (serv365.ai)
# 1. Connect (app-only shown; interactive: omit the certificate parameters)
Connect-ExchangeOnline -CertificateThumbprint $thumb -AppId $appId -Organization $org

# 2. Capture the current state first — you cannot roll back what you never recorded
$before = Get-SensitiveInformationScan
$before | Format-List

# 3. Make the change (dry run first)
Set-SensitiveInformationScan -Identity <PolicyIdParameter> -WhatIf
Set-SensitiveInformationScan -Identity <PolicyIdParameter>

# 4. Verify and diff
$after = Get-SensitiveInformationScan
Compare-Object ($before | Out-String) ($after | Out-String)

Syntax

Set-SensitiveInformationScan [-Identity] <PolicyIdParameter>
 [-AddEndpointDlpLocation <MultiValuedProperty>]
 [-AddEndpointDlpLocationException <MultiValuedProperty>]
 [-AddExchangeLocation <MultiValuedProperty>]
 [-AddOneDriveLocation <MultiValuedProperty>]
 [-AddOneDriveLocationException <MultiValuedProperty>]
 [-AddSharePointLocation <MultiValuedProperty>]
 [-AddSharePointLocationException <MultiValuedProperty>]
 [-AddTeamsLocation <MultiValuedProperty>]
 [-AddTeamsLocationException <MultiValuedProperty>]
 [-CancelScan <Boolean>]
 [-Comment <String>]
 [-Confirm]
 [-ExceptIfOneDriveSharedBy <RecipientIdParameter[]>]
 [-ExceptIfOneDriveSharedByMemberOf <RecipientIdParameter[]>]
 [-ExchangeSender <SmtpAddress[]>]
 [-ExchangeSenderException <SmtpAddress[]>]
 [-ExchangeSenderMemberOf <RecipientIdParameter[]>]
 [-ExchangeSenderMemberOfException <RecipientIdParameter[]>]
 [-Mode <PolicyMode>]
 [-OneDriveSharedBy <RecipientIdParameter[]>]
 [-OneDriveSharedByMemberOf <RecipientIdParameter[]>]
 [-PolicyRBACScopes <MultiValuedProperty>]
 [-RemoveEndpointDlpLocation <MultiValuedProperty>]
 [-RemoveEndpointDlpLocationException <MultiValuedProperty>]
 [-RemoveExchangeLocation <MultiValuedProperty>]
 [-RemoveOneDriveLocation <MultiValuedProperty>]
 [-RemoveOneDriveLocationException <MultiValuedProperty>]
 [-RemoveSharePointLocation <MultiValuedProperty>]
 [-RemoveSharePointLocationException <MultiValuedProperty>]
 [-RemoveTeamsLocation <MultiValuedProperty>]
 [-RemoveTeamsLocationException <MultiValuedProperty>]
 [-StartImpactAssessment <Boolean>]
 [-StopImpactAssessmentAndStartClassification <Boolean>]
 [-WhatIf]
 [<CommonParameters>]

Parameters (35)

ParameterTypeRequiredWhat it controls
-Identity PolicyIdParameter yes The Identity parameter specifies the sensitive information scan that you want to modify. You can use any value that uniquely identifies the scan. For example:
-AddEndpointDlpLocation MultiValuedProperty **Note**: This parameter requires membership in the Compliance Administrator or Compliance Data Administrator roles in Microsoft Entra ID.
-AddEndpointDlpLocationException MultiValuedProperty **Note**: This parameter requires membership in the Compliance Administrator or Compliance Data Administrator roles in Microsoft Entra ID.
-AddExchangeLocation MultiValuedProperty This parameter is reserved for internal Microsoft use.
-AddOneDriveLocation MultiValuedProperty This parameter is reserved for internal Microsoft use.
-AddOneDriveLocationException MultiValuedProperty This parameter is reserved for internal Microsoft use.
-AddSharePointLocation MultiValuedProperty The AddSharePointLocation parameter specifies the SharePoint sites to add to the list of included sites if you used the value All for the SharePointLocation parameter. You identify the site by its URL value.
-AddSharePointLocationException MultiValuedProperty The AddSharePointLocationException parameter specifies the SharePoint sites to add to the list of excluded sites if you used the value All for the SharePointLocation parameter. You identify the site by its URL value.
-AddTeamsLocation MultiValuedProperty This parameter is reserved for internal Microsoft use.
-AddTeamsLocationException MultiValuedProperty This parameter is reserved for internal Microsoft use.
-CancelScan Boolean The CancelScan parameter specifies whether to cancel an active scan in the classification stage. Valid values are:
-Comment String The Comment parameter specifies an optional comment. If you specify a value that contains spaces, enclose the value in quotation marks ("), for example: "This is an admin note".
-Confirm SwitchParameter The Confirm switch specifies whether to show or hide the confirmation prompt. How this switch affects the cmdlet depends on whether the cmdlet requires confirmation before proceeding.
-ExceptIfOneDriveSharedBy RecipientIdParameter[] The ExceptIfOneDriveSharedBy parameter specifies the users to exclude from the scan (the sites of the OneDrive user accounts are included in the scan). You identify the users by UPN (`laura@contoso.onmicrosoft.com`).
-ExceptIfOneDriveSharedByMemberOf RecipientIdParameter[] The ExceptIfOneDriveSharedByMemberOf parameter specifies the distribution groups or mail-enabled security groups to exclude from the scan (the OneDrive sites of group members are excluded from the scan). You identify...
-ExchangeSender SmtpAddress[] This parameter is reserved for internal Microsoft use.
-ExchangeSenderException SmtpAddress[] This parameter is reserved for internal Microsoft use.
-ExchangeSenderMemberOf RecipientIdParameter[] This parameter is reserved for internal Microsoft use.
-ExchangeSenderMemberOfException RecipientIdParameter[] This parameter is reserved for internal Microsoft use.
-Mode PolicyMode The Mode parameter specifies the scan mode. Valid values are:
-OneDriveSharedBy RecipientIdParameter[] The OneDriveSharedBy parameter specifies the users to include in the DLP scan (the sites of the OneDrive user accounts are included in the scan). You identify the users by UPN (`laura@contoso.onmicrosoft.com`).
-OneDriveSharedByMemberOf RecipientIdParameter[] The OneDriveSharedByMemberOf parameter specifies the distribution groups or mail-enabled security groups to include in the DLP scan (the OneDrive sites of group members are included in the scan). You identify the...
-PolicyRBACScopes MultiValuedProperty This parameter is reserved for internal Microsoft use.
-RemoveEndpointDlpLocation MultiValuedProperty **Note**: This parameter requires membership in the Compliance Administrator or Compliance Data Administrator roles in Microsoft Entra ID.
-RemoveEndpointDlpLocationException MultiValuedProperty **Note**: This parameter requires membership in the Compliance Administrator or Compliance Data Administrator roles in Microsoft Entra ID.
-RemoveExchangeLocation MultiValuedProperty The RemoveExchangeLocation parameter removes email messages from the scan if they're already included. The valid value for this parameter is All.
-RemoveOneDriveLocation MultiValuedProperty This parameter is reserved for internal Microsoft use.
-RemoveOneDriveLocationException MultiValuedProperty This parameter is reserved for internal Microsoft use.
-RemoveSharePointLocation MultiValuedProperty The RemoveSharePointLocation parameter specifies the SharePoint sites to remove from the list of included sites if you used the value All for the SharePointLocation parameter. You specify the site by its URL value.
-RemoveSharePointLocationException MultiValuedProperty The RemoveSharePointLocationException parameter specifies the SharePoint sites to remove from the list of excluded sites if you used the value All for the SharePointLocation parameter. You specify the site by its URL value.
-RemoveTeamsLocation MultiValuedProperty This parameter is reserved for internal Microsoft use.
-RemoveTeamsLocationException MultiValuedProperty This parameter is reserved for internal Microsoft use.
-StartImpactAssessment Boolean The StartImpactAssessment parameter specifies whether to start cost estimation for on-demand classification scans. Valid values are:
-StopImpactAssessmentAndStartClassification Boolean The StopImpactAssessmentAndStartClassification specifies whether to stop cost estimation and start classification for devices where estimation completed successfully. Valid values are:
-WhatIf SwitchParameter The WhatIf switch doesn't work in Security & Compliance PowerShell.

Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.