September 17, 2020

Office 365 PowerShell Scripts – TechNet Alternative

by Kathy Cooper

6 min read

No Comments

PowerShell for Microsoft 365 can show more information that cannot see with the Microsoft 365 admin center. So, Office 365 admins rely on PowerShell for their reporting and auditing needs. TechNet gallery acts as a source for Office 365 scripts and tools. O365reports has contributed many scripts and tools to the TechNet gallery.

Since the TechNet gallery is under retirement, it is necessary to find an alternative for TechNet gallery source. So, we have decided to link our blog post with the respective TechNet script.

Office 365 Reporting Tools:

Office 365 Reporting Tool TechNet:

This Microsoft 365 reporting tool offers 1500+ pre-built reports on Office 365 Users, License, Group, Group Members, Security, MFA/2FA, Password Expiry, License Expiry, Subscription Usage, Mailbox Usage, Spam, Malware, Emails Sent/Received, Mail Traffic, Browser Usage, Mailbox Quota, Mailbox Size, Mailbox Auditing, Mailbox Forwarding, External Forwarding, Inactive Mailboxes, Mailbox Permissions, Mailbox Protocols, ActiveSync, Mobile Devices, Mailboxes on Hold, Exchange Groups, Inbox Rules, Site Usage, Site Collection Auditing, Inactive Sites, SharePoint Admins, Guest Users, External Users, Anonymous Users, Site Group Members, PSTN Usage, Skype Conferences, Skype Active Users, Yammer Groups, Teams Channels, Teams and Channel members, Device Usages, Internal/External File Sharing, Office 365 Active/Inactive Users, Pro Plus Activations, Inactive Groups etc.

Along with these reports, this O365 reporting software offers 20 smart visually appealing dashboards in which you can get statistics about your Office 365 environment very easily.

Blog: PowerShell Free Office 365 Reporting Tool

TechNet download: https://gallery.technet.microsoft.com/Office-365-Reporting-Tool-7987b4c2

Office 365 Auditing Report Tool TechNet:

This Microsoft 365 auditing tool provides more than 600+ out-of-the-box Office 365 auditing reports, which are widely sought after by several Office 365 administrators. These reports provide rich information that is needed to monitor user activities, files, and shared items efficiently.

The auditing dashboards show the summarized activities performed on Office 365 application such as Azure AD, Exchange Online, SharePoint Online, OneDrive for Business, Microsoft Teams, Power BI and Security & Compliance Center.

Blog: Office 365 auditing tool

TechNet download: https://gallery.technet.microsoft.com/office/Office-365-Auditing-Tool-01747cd4

Office 365 Exchange Auditing and Reporting Tool TechNet:

This tool provides 390+ Exchange Online statistics & auditing reports along with visually appealing dashboards. This tool gives you the insights and statistics about the Mailbox Size, Mailbox Usage, Active & Inactive Mailboxes, Incoming and Outgoing Mail Traffic, Spam Emails, Malware Emails, Mailbox Permission, Mailbox Protocols Configurations, Enabled or Inactive ActiveSync Devices, Mailboxes on Hold, Email Signatures, OOF (Out of Office) configuration, Dynamic Distribution Groups, Role Groups, Inbox Rules/Filters, Non-Owner Mailbox Access, Mailbox Logins, Active Sync Device Changes, Internal/External Forwarding, Mailbox Rule Changes and more.

Blog: Office 365 Exchange auditing and reporting tool

TechNet download: https://gallery.technet.microsoft.com/Office-365-Exchange-Online-4ceee521

Office 365 PowerShell Scripts:

Office 365 License Report:

This script lists Office 365 licensed users with assigned licenses and service status. The script exports the result to a CSV file.

Blog: Export Office 365 user license report with PowerShell

TechNet link: https://gallery.technet.microsoft.com/Export-Office-365-User-079add3a

The output file stores most required attributes like Display Name, User Principal Name, Country, Licenses, License Friendly Name, Service, Service Friendly Name, and Service Status.

Office 365 MFA Report:

This PowerShell script exports Office 365 users’ MFA status report to CSV file. You can also generate a report based on the usersMFA status like enforced, enabled, and disabled.

Blog: Export Office 365 users MFA status report

TechNet link: https://gallery.technet.microsoft.com/Export-Office-365-Users-81747c73

MFA status report holds Display Name, User Principal Name, MFA Status, Activation Status, Default MFA Method, All MFA Methods, MFA Phone, MFA Email, License Status, Department, IsAdmin, Admin Roles, and SignIn Status.

Office 365 Last Login Report:

The script exports Office 365 users’ last logon time using PowerShell cmdlet Get-MailboxStatistics (LastLogonTime).

Blog: Export Office 365 users’ last logon time to CSV

TechNet link: https://gallery.technet.microsoft.com/office/Export-Office-365-Users-ae3463f2

The exported report has User Principal Name, Display Name, Last Logon Time, Creation Time, Inactive Days, Mailbox Type, Assigned Licenses (Friendly Name), Admin Roles.

Office 365 Last Password Change Report:

This script helps to generate 7 different password expiration reports such as password expired users report, users with password never expiry report, soon-toexpire password, recent password changers, etc.

Blog: Office 365 password expiration report

TechNet link: https://gallery.technet.microsoft.com/Export-Office-365-Users-91b4fc50

Output CSV file holds Display Name, User Principal Name, Password last Change Date, Password Since Last Set (Password Age), Password Expiry Date, Friendly Expiry Time, License Status, and Days Since Expiry/Days to Expiry.

Office 365 License Expiration Date Report:

This script helps to check Office 365 license expiry date using PowerShell. It also includes the next life cycle activity date.’

Blog: Export Office 365 license expiry date report using PowerShell

TechNet link: https://gallery.technet.microsoft.com/Export-Office-365-License-59e16536

The exported subscription expiry date report has Subscription Name, Friendly Subscription Name, Subscribed Date, Subscription Type, Next Life Cycle Activity Date, Friendly Expiry Date, and Subscription Status.

Office 365 Inactive Users Report:

The script exports inactive users report using PowerShell cmdlet Get-MailboxStatistics (LastUserActionTime attribute). You can also use the report to find Office 365 last activity date.

Blog: Export Office 365 inactive users report

TechNet link: https://gallery.technet.microsoft.com/Export-Office-365-Users-05819ea5

The exported report has User Principal Name, Display Name, Last Logon Time, Creation Time, Inactive Days, Mailbox Type, Assigned Licenses (Friendly Name), Admin Roles.

Audit Office 365 Users Login History Report:

The script exports Office 365 users’ logon history report to CSV file. Logon history includes both successful and failed login attempts. You can use advanced filtering options to get succeeded/failed login attempts alone.

The report audits login events in Azure Active Directory. Exchange Online and Microsoft Teams.

Blog: Export Office 365 users logon history report

TechNet link: https://gallery.technet.microsoft.com/Export-Office-365-Users-d83e98ca

The exported login history report shows Login Time, User Name, Login IP Address, Operation, Result Status, and Workload.

Office 365 Group Membership Report

Export Distribution List Members to CSV:

This PowerShell script gets all distribution groups available in the Office 365 environment and their members. The script exports output to nicely formatted 2 CSV files. One with detailed information and another with summary information.

Blog: Export Office 365 Distribution List Members Report

TechNet link: https://gallery.technet.microsoft.com/Export-Office-365-811ad3a2

The exported distribution group membership report has Group Display Name, Primary SMTP Address, Group Alias, Group Members Count, Group Members, Member Primary SMTP Address, Member Recipient Type, Authorized Senders, etc.

Dynamic Distribution Group Members Report:

This PowerShell script helps to view Dynamic Distribution Group (DDL) members with count and exports the result to the CSV file.

Blog: Export Dynamic Distribution List members to CSV

TechNet download: https://gallery.technet.microsoft.com/office/Export-Office-365-Dynamic-7f66e229

The group members report holds Group Display Name, Primary SMTP Address, Group Alias, Group Members Count, Group Members, Group Manager, Member Type, etc.

Office 365 Connection Scripts

Connect to Exchange Online PowerShell Script:

This PowerShell helps to connect Exchange Online PowerShell with MFA and non-MFA account. For the MFA account, the script uses the Connect-EXOPSSession cmdlet.

Blog: Connect to Exchange Online PowerShell

TechNet download: https://gallery.technet.microsoft.com/Connect-to-Exchange-Online-7d7365e0

Connect to all Office 365 Services PowerShell:

The script installs all Office 365 PowerShell modules such as Azure AD, MSOnline, Exchange Online, SharePoint Online, Microsoft Teams, Skype for Business, and Security & Compliance Center upon your confirmation (if not installed already).

Blog: Connect to all Office 365 services via PowerShell

TechNet link: https://gallery.technet.microsoft.com/PowerShell-Script-to-4081ec0f

Also, the script helps to connect one or more Office 365 services using a single cmdlet.

Exchange Online PowerShell Scripts

Office 365 Mailbox Permission Report:

This PowerShell script exports Office 365 mailbox permissions report to CSV file. It includes permissions like full access, send-as, and send-on-behalf.

Blog: Get mailbox permissions report using PowerShell

TechNet download: https://gallery.technet.microsoft.com/office/Export-Office-365-Mailbox-d5c8c85f

Exchange mailbox permissions report has Display Name, User Principal Name, Mailbox Type, Access Type, User with Access, and Admin Roles.

Shared Mailbox Members and Permissions Report:

The PowerShell script lists shared mailboxes members and permissions like full access, send-as, and send-on-behalf.

Blog: Export shared mailbox members and permissions report

TechNet download: https://gallery.technet.microsoft.com/Export-Shared-Mailbox-a3e98676

The exported report stores Display Name, User Principal Name, Primary SMTP Address, Email Aliases, Access Type, and User with Access.

Export Non-owner Mailbox Access Report:

This script helps to detect who accessed another user’s mailbox. The script audits mailbox access done by the administrator, delegates, and external users.

Blog: Run non-owner mailbox access report

TechNet download: https://gallery.technet.microsoft.com/Export-Non-Owner-Mailbox-70658d6d

The exported report has Access Time, Logon Type, Accessed by (Non-owner), Performed Operation, Accessed Mailbox (Delegated Mailbox), Result, and the External Access.

Enable Mailbox Auditing in Office 365:

Everyone believes that Mailbox auditing is enabled in Office 365 by default. But that is not 100% true. Only specific actions are audited by default. The script helps to enable mailbox auditing for all actions or set of actions.

Blog: Enable mailbox auditing in Office 365 with PowerShell

TechNet download: https://gallery.technet.microsoft.com/Enable-Mailbox-Audit-7742476e

Add External Email Warning in Office 365:

The script helps to add external warning messages and external disclaimers for external emails. You can also exclude group mailboxes like support, sales that facing the external world.

Blog: Add external email warning in Office 365

TechNet download: https://gallery.technet.microsoft.com/Add-External-Email-Warning-7e468ded

The blog also describes the GUI method to configure external email warning messages.

We hope you can use and access these Office 365 PowerShell scripts even after Microsoft retires the TechNet gallery. Do share this post with your fellow admins to help them.

Share article