diff --git a/Modules/CIPPCore/Public/Invoke-CIPPOffboardingJob.ps1 b/Modules/CIPPCore/Public/Invoke-CIPPOffboardingJob.ps1 index 6fb164fe356c..4232a71adaf4 100644 --- a/Modules/CIPPCore/Public/Invoke-CIPPOffboardingJob.ps1 +++ b/Modules/CIPPCore/Public/Invoke-CIPPOffboardingJob.ps1 @@ -68,7 +68,8 @@ function Invoke-CIPPOffboardingJob { } { $_."RemovePermissions" } { if ($RunScheduled) { - Remove-CIPPMailboxPermissions #Finish this + Remove-CIPPMailboxPermissions -PermissionsLevel @("FullAccess", "SendAs", "SendOnBehalf") -userid "AllUsers" -AccessUser $UserName -TenantFilter $TenantFilter -APIName $APINAME -ExecutingUser $ExecutingUser + } else { $object = [PSCustomObject]@{ diff --git a/Modules/CIPPCore/Public/Remove-CIPPMailboxPermissions.ps1 b/Modules/CIPPCore/Public/Remove-CIPPMailboxPermissions.ps1 index b11a1bfbe7d9..c9e480445056 100644 --- a/Modules/CIPPCore/Public/Remove-CIPPMailboxPermissions.ps1 +++ b/Modules/CIPPCore/Public/Remove-CIPPMailboxPermissions.ps1 @@ -13,6 +13,10 @@ function Remove-CIPPMailboxPermissions { if ($userid -eq "AllUsers") { $Mailboxes = New-ExoRequest -tenantid $TenantFilter -cmdlet "get-mailbox" $Mailboxes | ForEach-Object -Parallel { + Import-Module ".\Modules\CIPPCore" + import-module ".\GraphHelper.psm1" + Import-Module ".\Modules\AzBobbyTables" + Write-Host "Removing permissions from mailbox $($_.UserPrincipalName)" Remove-CIPPMailboxPermissions -PermissionsLevel @("FullAccess", "SendAs", "SendOnBehalf") -userid $_.UserPrincipalName -AccessUser $using:AccessUser -TenantFilter $using:TenantFilter -APIName $using:APINAME -ExecutingUser $using:ExecutingUser } -ThrottleLimit 10 } diff --git a/version_latest.txt b/version_latest.txt index 28446a5ea556..f4fa8fcb995d 100644 --- a/version_latest.txt +++ b/version_latest.txt @@ -1 +1 @@ -4.6.0 \ No newline at end of file +4.6.1 \ No newline at end of file