I have worked in IT for about 20 years. A lot of that was MSP operations. Today I work as an M365 cloud admin.
I kept writing the same scripts. So I cleaned them up and shared them on GitHub. This toolkit is for OneDrive for Business admins. It uses the SPO module and Microsoft Graph with PowerShell 7.
Repo: onedrive-powershell-toolkit
The problem it solves
When someone leaves, their manager often needs their files. Doing that by hand is fiddly.
Users also share files with "anyone" links and forget about them.
And before a migration, new users may not have a OneDrive yet. These scripts handle all three.
Highlight scripts
Grant-DepartedUserOneDriveAccess.ps1
Gives a manager access to a leaver's OneDrive as a secondary admin. A matching script removes that access later.
. / Grant - DepartedUserOneDriveAccess . ps1 - DepartedUser former . user @ contoso . com - Delegate manager @ contoso .…