Jun 10 2020 10:03 AM
Get-SPOSite how to get all sites on my tenant with a Sensitivity label = Highly Confidential?
The Powershell command Get-SPOSite gets all sites on my Office 365 tenant. How could I filter all site with a sensitivy label?
Jun 10 2020 11:50 PM
Use a filter against the SensitivityLabel property? It has to be a client-side filter though, via where-object, as the -Filter parameter doesn't seem to support the SensitivityLabel property.
Jun 11 2020 08:16 AM
Jun 11 2020 08:28 AM
Try using the -Detailed switch.
Jun 11 2020 08:48 AM
Feb 11 2021 02:51 AM
@fhunth for what it's worth it seems that SensitivityLabel property is filled only if you use the -Identity $siteUrl filter. So you would need to iterate through all the sites and get the sites again :(.
So basically you need to iterate
$sites=Get-SPOSite -Limit ALL
$sites | ForEach-Object {
$site=Get-SPOSite -Identity $siteUrl
if ($site.SensitivityLabel -eq 'ID-HighlyCOnfidential')
{
return $site
}
}