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 {
45
45
# Get current Graph policy state
46
46
$Uri = ' https://graph.microsoft.com/beta/admin/people/photoUpdateSettings'
47
47
$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 }
50
49
$GraphStateCorrect = $UsersCanChangePhotos -eq $DesiredState
51
50
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
+
52
56
# Get current OWA mailbox policy state
53
57
$CurrentOWAState = New-ExoRequest - tenantid $Tenant - cmdlet ' Get-OwaMailboxPolicy' - cmdParams @ {Identity = ' OwaMailboxPolicy-Default' } - Select ' Identity,SetPhotoEnabled'
54
58
$OWAStateCorrect = $CurrentOWAState.SetPhotoEnabled -eq $DesiredState
55
59
60
+ # Check if both states are correct
56
61
$CurrentStatesCorrect = $GraphStateCorrect -eq $true -and $OWAStateCorrect -eq $true
57
62
58
63
if ($Settings.remediate -eq $true ) {
You can’t perform that action at this time.
0 commit comments