Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/BNWEIN/CIPP-API into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
BNWEIN committed Nov 13, 2023
2 parents 02bf671 + 7c8ef7b commit a5933df
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 a5933df

Please sign in to comment.