Skip to content

Commit f3427ab

Browse files
committed
fix: please stop fighting with On-Premise shared mailboxes
fix
1 parent e96cc95 commit f3427ab

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardDisableSharedMailbox.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function Invoke-CIPPStandardDisableSharedMailbox {
3333
param($Tenant, $Settings)
3434
##$Rerun -Type Standard -Tenant $Tenant -Settings $Settings 'DisableSharedMailbox'
3535

36-
$UserList = New-GraphGetRequest -uri 'https://graph.microsoft.com/v1.0/users?$top=999&$filter=accountEnabled eq true' -Tenantid $tenant -scope 'https://graph.microsoft.com/.default'
36+
$UserList = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/users?$top=999&$filter=accountEnabled eq true and onPremisesSyncEnabled ne true&$count=true' -Tenantid $tenant -scope 'https://graph.microsoft.com/.default' -ComplexFilter
3737
$SharedMailboxList = (New-GraphGetRequest -uri "https://outlook.office365.com/adminapi/beta/$($Tenant)/Mailbox" -Tenantid $tenant -scope ExchangeOnline | Where-Object { $_.RecipientTypeDetails -EQ 'SharedMailbox' -or $_.RecipientTypeDetails -eq 'SchedulingMailbox' -and $_.UserPrincipalName -in $UserList.UserPrincipalName })
3838

3939
If ($Settings.remediate -eq $true) {

0 commit comments

Comments
 (0)