Monthly PowerShell Automation Tasks for Microsoft 365 Admins

Monthly PowerShell Automation Tasks for Microsoft 365 Admins

Manual Microsoft 365 administration can become time-consuming, especially when dealing with repetitive tasks.
PowerShell automation lets you handle them faster, with fewer mistakes, and on a schedule.

This article highlights monthly PowerShell tasks that every M365 admin should automate for better efficiency and control.


1. License Usage Audit

Goal: Identify unused licenses to save costs.

Get-MsolAccountSku | Select-Object AccountSkuId, ActiveUnits, ConsumedUnits

2. Inactive User Detection

Goal: Spot accounts with no sign-in activity for 30+ days.

Connect-MgGraph -Scopes "AuditLog.Read.All"

Get-MgUser | Where-Object {($_.SignInActivity.LastSignInDateTime -lt (Get-Date).AddDays(-30))} | 
Select-Object DisplayName, UserPrincipalName

3. Mailbox Forwarding Check

Goal: Detect potential data leaks.

Get-Mailbox -ResultSize Unlimited | 
Where-Object {$_.ForwardingSMTPAddress -ne $null} | 
Select-Object DisplayName, ForwardingSMTPAddress

4. Admin Role Review

Goal: Maintain least privilege.

Get-MsolRole | ForEach-Object {
    $role = $_
    Get-MsolRoleMember -RoleObjectId $role.ObjectId | 
    Select-Object @{Name="Role";Expression={$role.Name}}, EmailAddress
}

5. MFA Enforcement Report

Goal: Track users who don’t have MFA enabled.

Get-MsolUser -All | 
Select-Object DisplayName, UserPrincipalName, StrongAuthenticationRequirements

6. Distribution Group Export

Goal: Document communication lists for compliance.

Get-DistributionGroup | ForEach-Object {
    $group = $_.Name
    Get-DistributionGroupMember -Identity $_.Identity | 
    Select-Object @{Name="GroupName";Expression={$group}}, Name, PrimarySmtpAddress
}

7. Secure Score API Data Collection

Goal: Track your Secure Score trends monthly.

Connect-MgGraph -Scopes "SecurityEvents.Read.All"
# Example: Retrieve Secure Score summary
Get-MgSecuritySecureScore

Automate It

Use Windows Task Scheduler or Azure Automation to run these scripts automatically each month:

Export results to a central SharePoint library.

Send email alerts to admins.

Build Power BI dashboards for ongoing visibility.

Final Thoughts

Routine admin work doesn’t need to be manual. Automating these PowerShell tasks ensures consistent security, better reporting, and reduced operational overhead.

Techatix helps organizations implement scalable Microsoft 365 automation strategies. Reach out if you’d like us to build your custom PowerShell toolkit.

#Microsoft365 #PowerShell #Automation #Office365Admin #TechatixTips #CloudSecurity