File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Modules/CIPPCore/Public/Standards Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -45,14 +45,19 @@ function Invoke-CIPPStandardProfilePhotos {
4545 # Get current Graph policy state
4646 $Uri = ' https://graph.microsoft.com/beta/admin/people/photoUpdateSettings'
4747 $CurrentGraphState = New-GraphGetRequest - uri $Uri - tenantid $Tenant
48- $UsersCanChangePhotos = if (($CurrentGraphState.allowedRoles -contains ' fe930be7-5e62-47db-91af-98c3a49a38b1' -and $CurrentGraphState.allowedRoles -contains ' 62e90394-69f5-4237-9190-012177145e10' ) -or
49- $null -ne $CurrentGraphState.allowedRoles ) { $false } else { $true }
48+ $UsersCanChangePhotos = if ([string ]::IsNullOrWhiteSpace($CurrentGraphState.allowedRoles ) ) { $true } else { $false }
5049 $GraphStateCorrect = $UsersCanChangePhotos -eq $DesiredState
5150
51+ if ($UsersCanChangePhotos -eq $false -and $DesiredState -eq $false ) {
52+ # Check if the correct roles are present
53+ $GraphStateCorrect = $CurrentGraphState.allowedRoles -contains ' 62e90394-69f5-4237-9190-012177145e10' -and $CurrentGraphState.allowedRoles -contains ' fe930be7-5e62-47db-91af-98c3a49a38b1'
54+ }
55+
5256 # Get current OWA mailbox policy state
5357 $CurrentOWAState = New-ExoRequest - tenantid $Tenant - cmdlet ' Get-OwaMailboxPolicy' - cmdParams @ {Identity = ' OwaMailboxPolicy-Default' } - Select ' Identity,SetPhotoEnabled'
5458 $OWAStateCorrect = $CurrentOWAState.SetPhotoEnabled -eq $DesiredState
5559
60+ # Check if both states are correct
5661 $CurrentStatesCorrect = $GraphStateCorrect -eq $true -and $OWAStateCorrect -eq $true
5762
5863 if ($Settings.remediate -eq $true ) {
You can’t perform that action at this time.
0 commit comments