Forum Discussion
PaddyB
Dec 25, 2021Brass Contributor
PowerShell for Leaver
Hi all
Merry XMAS to you all
how you guys handle leavers? so employees what are leaving the company?
I'm looking for a good PowerShell to make my life much easier...
my idea right now is
- remove the User-Account from all Distribution and other Groups
- Hide the User from GAL (Global Address List)
- Setup eMail-Forwarding
- Remove Licenses and add just an Exchange Online Plan 2 (needed, because our users have over 50GB Mailboxes and we keep them as Shared)
- Change the Mailbox to a Shared-Mailbox
- we also set the Display-Name to something that we can identify as a Leaver
we keep this for 12 Months
- Remove all "Full Permissions" for Mailbox
- Activate Litigation Hold for 10 Years
these are at moment 2 Scripts - but sadly often with errors.
so my question is - How the heck are other Admins doing this "daily business stuff"?
1 Reply
Sort By
- PowerShell is still the best tool for this, IMO. Errors can be fixed, even with the quirks of Remote PowerShell, you have sufficient tools for proper error handling. Most of the steps you mentioned above are simple oneliners, and the expected result can be verified easy, so if needed you can retry a given step. For the ones that are more complicated, such as remove from all Groups, you will need a proper, full-blown script and some testing to make sure you've addressed all the peculiarities in your specific environment. Here's one such script I wrote a while back: https://www.michev.info/Blog/Post/2161/script-to-remove-users-from-all-groups-in-office-365