Skip to content

Commit 7730882

Browse files
committed
Fix EXO Duplicate Identity Error
1 parent 35f4170 commit 7730882

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardDisableBasicAuthSMTP.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function Invoke-CIPPStandardDisableBasicAuthSMTP {
5959
# Disable SMTP Basic Authentication for all users
6060
$SMTPusers | ForEach-Object {
6161
try {
62-
New-ExoRequest -tenantid $Tenant -cmdlet 'Set-CASMailbox' -cmdParams @{ Identity = $_.Identity; SmtpClientAuthenticationDisabled = $null } -UseSystemMailbox $true
62+
New-ExoRequest -tenantid $Tenant -cmdlet 'Set-CASMailbox' -cmdParams @{ Identity = $_.Guid; SmtpClientAuthenticationDisabled = $null } -UseSystemMailbox $true
6363
Write-LogMessage -API 'Standards' -tenant $tenant -message "Disabled SMTP Basic Authentication for $($_.DisplayName), $($_.PrimarySmtpAddress)" -sev Info
6464
} catch {
6565
$ErrorMessage = Get-NormalizedError -Message $_.Exception.Message

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardDisableExchangeOnlinePowerShell.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function Invoke-CIPPStandardDisableExchangeOnlinePowerShell {
4444
try {
4545

4646
$AdminUsers = (New-GraphGetRequest -uri 'https://graph.microsoft.com/v1.0/roleManagement/directory/roleAssignments?$expand=principal' -tenantid $Tenant).principal.userPrincipalName
47-
$UsersWithPowerShell = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-User' -Select 'userPrincipalName, identity, remotePowerShellEnabled' | Where-Object { $_.RemotePowerShellEnabled -eq $true -and $_.userPrincipalName -notin $AdminUsers }
47+
$UsersWithPowerShell = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-User' -Select 'userPrincipalName, identity, guid, remotePowerShellEnabled' | Where-Object { $_.RemotePowerShellEnabled -eq $true -and $_.userPrincipalName -notin $AdminUsers }
4848
$PowerShellEnabledCount = ($UsersWithPowerShell | Measure-Object).Count
4949
$StateIsCorrect = $PowerShellEnabledCount -eq 0
5050
} catch {
@@ -61,7 +61,7 @@ function Invoke-CIPPStandardDisableExchangeOnlinePowerShell {
6161
@{
6262
CmdletInput = @{
6363
CmdletName = 'Set-User'
64-
Parameters = @{Identity = $_.Identity; RemotePowerShellEnabled = $false }
64+
Parameters = @{Identity = $_.Guid; RemotePowerShellEnabled = $false }
6565
}
6666
}
6767
}

0 commit comments

Comments
 (0)