THIS IS ONLY FOR 365 WITH SYNC TO ON PREMISE DIRECTORY
- Remove from GAL
- Remove from disitribution lists
- Add an auto reply
- Add read+manage permissions
- Add mailbox forwarding
Git must be installed
Powershell 7+ should be installed
A custom rule must be set in ADConnect that looks for msDS-CloudExtensionAttribute1 to be set to HideFromGAL (https://www.uclabs.blog/2023/06/how-to-hide-users-from-gal-if-they-are.html)
-
Ensure Git is installed.
-
Ensure Powershell 7+ is installed. (Built in PS7+ but 5+ will probably work)
-
cdintoC:\users\$env:username\documents\powershell\modulesif using powershell core,C:\users\$env:username\documents\windowspowershell\modulesif using powershell 5 -
Run
git clone https://github.com/Techary/Leavers-Process-OnPrem.git -
cdinto the newly created folder -
Run
.\setup.ps1. -
When prompted, sign in with an account with access to these scopes:
Application.ReadWrite.All
User.Read
Domain.Read.All
Directory.ReadWrite.All
RoleManagement.ReadWrite.Directory
-
Accept the admin request
-
Follow the instructions on the CLI (it should give you a link to follow to grant further admin consent)
-
Run
import-module .\Leavers-Process-OnPrem.psm1 -
(Optional) Create a powershell profile and add
import-module <pathToPowershellModulesFolder>\Leavers-Process-OnPrem.psm1
- Open powershell as an administrator.
- Run
git pullwhile in the<pathToPowershellModulesFolder>\Leavers-Process-OnPremfolder. This ensures the process is up-to-date. - Run
import-module <pathToPowershellModulesFolder>\Leavers-Process-OnPrem.psm1(If you skipped step 11) - Run
invoke-leaverprocess <upn>
See the Wiki for more examples.