Skip to content

Commit

Permalink
Fixed Missing Return
Browse files Browse the repository at this point in the history
Fixed missing return
  • Loading branch information
BNWEIN committed Nov 11, 2023
1 parent 122ee80 commit 7c8ef7b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Modules/CIPPCore/Public/Remove-CIPPMobileDevice.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ function Remove-CIPPMobileDevice {
$devices = New-ExoRequest -tenantid $tenantFilter -cmdlet "Get-MobileDevice" -Anchor $username -cmdParams @{mailbox = $username } | ForEach-Object {
try {
New-ExoRequest -tenantid $tenantFilter -cmdlet "Remove-MobileDevice" -Anchor $username -cmdParams @{Identity = $_.Identity }
"Removed device: $($_.FriendlyName)"
return "Removed device: $($_.FriendlyName)"
}
catch {
"Could not remove device: $($_.FriendlyName)"
return "Could not remove device: $($_.FriendlyName)"
continue
}
}

Write-LogMessage -user $ExecutingUser -API $APIName -message "Deleted mobile devices for $($username)" -Sev "Info" -tenant $tenantFilter
return "Deleted mobile devices for $($username)"
}
catch {
Write-LogMessage -user $ExecutingUser -API $APIName -message "Could not delete mobile devices for $($username): $($_.Exception.Message)" -Sev "Error" -tenant $tenantFilter
Expand Down

0 comments on commit 7c8ef7b

Please sign in to comment.