Skip to content

Commit 63b5cf5

Browse files
Merge pull request KelvinTegelaar#1356 from Ren-Roros-Digital/DisableSharedMailbox
fix: please stop fighting with On-Premise shared mailboxes
2 parents 9502e20 + f3427ab commit 63b5cf5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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)