Collection of PowerShell scripts for Microsoft 365, Microsoft Entra ID, and a few Windows admin tasks.
Scripts are grouped by product so you can open a folder and see only what you need. Replace placeholders before you run anything.
| Folder | What you will find |
|---|---|
| Exchange-Online | Retention hold, address lists, room mailbox auto-release, empty shared mailboxes |
| Microsoft-Entra | MFA authentication-methods report, remove app permissions |
| SharePoint-Online | Bulk site-collection admins |
| Teams | Export teams and members (optionally with SharePoint) |
| OneDrive | List files shared via OneDrive |
| Windows | Remote lock, system language, copy files, local Mail duplicate cleanup |
Each folder has its own README.md with a one-line description per script.
Install the module you need, then connect before running the related scripts:
| Workload | Module | Connect |
|---|---|---|
| Exchange Online | ExchangeOnlineManagement |
Connect-ExchangeOnline |
| Microsoft Graph / Entra | Microsoft.Graph |
Connect-MgGraph |
| SharePoint Online | Microsoft.Online.SharePoint.PowerShell |
Connect-SPOService |
| Teams | MicrosoftTeams |
Connect-MicrosoftTeams |
Some older scripts still use MSOnline, AzureADPreview, or raw Graph REST. Prefer interactive Graph / Exchange modules when you update a script.
Several scripts ship with sample values. Replace them with your tenant data:
TuoClientID,TuoClientSecret,TuoTenantID[Your Mailbox adress here],youremail@provider.comexample.com,user1@example.comcontoso.sharepoint.com,https://example-admin.sharepoint.com
Do not commit real client secrets.
.\SharePoint-Online\Bulk-Add-TenantSiteAdmins.ps1 `
-AdminUrl "https://contoso-admin.sharepoint.com" `
-AdminAccounts @("admin@contoso.com") `
-WhatIfSee LICENSE.txt.