You might just need this.
A complete, ordered, audit-trailed Microsoft 365 user offboarding — in pure PowerShell. One command (or one double-click) locks an account, cleans up its access, preserves the mailbox as a shared ...
Some results have been hidden because they may be inaccessible to you
Show inaccessible results