Welcome to 365 Admin - Office 365 Administration for Beginners



Office 365 Administration can be overwhelming for a beginner. The preparation and configuration of your admin PC can be a challenge if you aren't aware of what you need to install to manage the cloud effectively. Plus it is important to be aware of limitations in your browser when you are administering multiple Office 365 tenants.

There are multitudes of technical blogs for the advanced Office 365 administrator, but nothing focused on beginners. It is for this reason I have created this blog, to guide Office 365 Administrators through all the challenges that beginners will face.

Everything you need to become a competent Office 365 Administrator is here, all in one place.

My mission in this technical blog is to provide tips, tutorials and scripts to the professional IT community, with particular focus on helping newcomers with little real world experience in Office 365.

In this blog, I will be publishing Tutorials to help you quickly create powerful scripts to manage your environment, whether it is 5 users or 500,000 users. These tutorials also cover MFA (Multi-Factor Authentication as well as Hybrid Office 365 environments.

This content will cater for various environments from small businesses with a cloud only presence to Enterprise hybrid environments managing hundreds of thousands of mailboxes.

I hope this blog helps on your journey into the world of Office 365.

Tutorials - by subject
*** Complete list of all my tutorials - Link
Hybrid Administration tutorials - Link
MFA (Multi-Factor Authentication) Tutorials -Link
Enterprise Management - Link

TechNet PowerShell Script Repository - (no support articles)
Microsoft TechNet Gallery Downloads - Link

PowerShell TechNet Downloads with support articles - 
All my PowerShell TechNet downloads and support articles - Link

Linked-In - Link

About Me - Link

All my PowerShell TechNet downloads and support articles



All my PowerShell TechNet Downloads - TechNet Link


Connection Scripts

Office 365 Connection Script with Modern Auth - Supports MFA (Multi-Factor Auth) 
- Download - Link
- Support article - Link

Office 365 and Azure PowerShell Connection Script (No MFA support)
- Download - Link
- Support article - Link

Office 365 Hybrid, Azure and Local Active Directory PowerShell Connection Script
- Download - Link
- Support article - Link

PowerShell Connection script for Exchange Admins - (Exchange Online and Azure AD only)
- Download - Link
- Support article - Link




Documentation and Administration Scripts

Exchange Online Configuration Documentation Script 
- Download - Link
- Support Article - Link

Exchange Local Organization documentation script for auditing and creating As Built docos 
- Download - Link
- Support Article - Link

Group Membership Pack for Office 365, Local AD and Exchange
- Download - Link
- Support Articles - Part 1 - Part 2

Mailbox Permission Pack for Exchange Online and Exchange On-Premises 
- Download - Link
- Support Article - Link

Hybrid Office 365 Administration Pack - Including scripts and csv files 
- Download - Link
- Support Article - Link

Scripts to update UPN to match the user's Primary SMTP email address 
- Download - Link
- Support Article - Link

-----------------------------------------------------------------------------------------------------------

Details of my Connection Scripts


--- Connection Script to Office 365 and Azure with MFA support ---

Office 365 Connection Script with Modern Auth - Supports MFA (Multi-Factor Auth)

- Download - Link
- Support article - Link

Script with GUI based connection to all Office 365 services that support Modern Auth and MFA
- Exchange Online
- SharePoint Online
- Skype for Business Online
- Azure AD v1
- Azure AD v2
- Azure Resource Manager
- Azure Rights Manager
- Security and Compliance Center



--- Connection Script to Office 365 and Azure (No MFA support) ---

Office 365 and Azure PowerShell Connection Script

- Download - Link
- Support article - Link

Connects to all Azure and Office 365 services, including
- Exchange Online
- Azure AD v1.0
- Azure AD v2.0
- SharePoint Online
- Skype for Business Online
- Exchange Online Protection
- Security and Compliance Center
- Azure Resource Manager
- Azure Rights Manager
--- Updated version supports Proxy or no Proxy ---



--- Connection Script for Hybrid with local AD and Local Exchange ---

Office 365 Hybrid, Azure and Local Active Directory PowerShell Connection Script

- Download - Link
- Support article - Link

This single script will connect to the following Local and Cloud services
- Exchange On-Premises
- Active Directory On-Premises
- Exchange Online
- Azure AD v1.0
- Azure AD v2.0
- SharePoint Online
- Skype for Business Online
- Exchange Online Protection
- Security and Compliance Center
- Azure Resource Manager
- Azure Rights Manager
- Azure AD Connect (DirSync)


--- Connection script for Exchange Admins - (Exchange Online and Azure AD only) ---

Office 365 Connection Script - Basic

- Download - Link
- Support article - Link

This PowerShell connection script is perfect for Exchange and user administration as it quickly connects to the following Office 365 Services.
- Exchange Online
- Azure AD v1.0 - (MSOL)
- Azure AD v2.0 - (Azure AD)


------------------------------------------------------------------------------------------------------------


Details of my Documentation and Administration Scripts


--- Exchange Online Configuration Documentation Script ---

Script to document your Exchange Online Configuration

- Download - Link
- Support Article - Link

The script generates a separate report for each of the following for Exchange Online.
- Accepted Domains
- Azure AD Connect - Directory Sync status
- Free/Busy configuration
- Inbound Connectors
- Outbound Connectors
- Mailbox count
- Mailbox details
- Mailboxes with Forwarders
- Mailboxes with Full Access Delegates
- Mailboxes with Send As Delegates
- Mailboxes with Send on Behalf Delegates
- Users configured with MFA - Multi-Factor Authentication
- Mobile device policies
- OWA Mailbox policies
- Tenant Administrators
- Transport Rules




--- Script for documenting local Exchange Organizations for creating As Built docos ---

Exchange Organization documentation script for auditing and creating As Built docos

- Download - Link
- Support Article - Link

This script generates a separate report for each of the following for all the local Exchange servers in your Organization
- Exchange SSL certificates
- Internal DNS records of your external domain (split DNS or pinpoint DNS records)
- OWA Virtual Directory URL
- ActiveSync Virtual Directory URL
- Outlook Anywhere configuration
- AutoDiscover Virtual Directory URL
- OAB Virtual Directory URL
- Web Services Virtual Directory URL
- Accepted Domains
- Email Address Policy configuration
- Receive Connectors configuration
- Send Connectors configuration
- Transport configuration
- Mailbox Database configuration
- Exchange Server configuration, including Exchange version
- OWA Mailbox Policies
- Mobile Device Policies
- Transport Rules
- Exchange Administrators
- Mailbox Details
- Mailboxes with Forwarders
- Mailboxes with Full Access Delegates
- Mailboxes with Send As Delegates
- Mailboxes with Send on Behalf Delegates
- Mailbox statistics



--- Group Membership Pack for Office 365, Local AD and Exchange ---

This pack of ten PowerShell scripts will generate csv reports of ALL groups and their members in local AD and local Exchange, Azure AD, and Exchange Online, including dynamic distribution groups and Office 365 Groups (Unified Groups) and their members.

Download - Link
Support Articles - Part 1 - Part 2

--- Azure AD and Exchange Online Scripts ---

All Azure AD Groups and their members
- Export a csv of all groups in Azure AD and their members (including synced groups via Hybrid)

Single user group membership
- Export a csv of all groups a single user is a member of, including Unified Groups (Office 365 groups)

All Exchange Online Distribution Groups and their members
- Export a csv of all Exchange Online distribution groups and their members

All Exchange Online Dynamic Distribution Groups and their members
- Export a csv of all Exchange Online dynamic distribution groups and their members

All Unified Groups and their members (Office 365 Groups)
- Export a csv of all Unified groups and their members (Office 365 Groups)


--- Local AD and Exchange On-premises Scripts ---

All Local AD Groups and their members - Scoped to a particular OU and the sub-OUs
- Export a csv of all groups in Local AD and their members

All Local AD Groups and their members
- Export a csv of all groups in Local AD and their members

Single User group membership
- Export a csv of all groups a single user is a member of

All Local Exchange Distribution Groups and their members
- Export a csv of all Local Exchange distribution groups and their members

All Local Exchange Dynamic Distribution Groups and their members
- Export a csv of all Local Exchange dynamic distribution groups and their members




--- Mailbox Permission Pack for Exchange Online and Exchange On-Premises ---

Pack of ten PowerShell scripts to report on virtually any mailbox or folder permission for both Exchange Online and Exchange on-premises

- Download - Link
- Support Article - Link

Ten scripts that will report on Send As, Send on Behalf and Full Access in both Exchange Online and Exchange Local. Includes reports on which mailboxes a particular user has access to and report on all mailboxes that are configured with permissions and who has that access.

The Mailbox Permission Pack scripts perform three main functions in either Exchange Online or Exchange On-premises.

Single mailbox - Who has access to this mailbox
Generate reports on a single mailbox -
- Reports which users have Full Access, Send-As, Send on Behalf and Delegated Folder permissions to the mailbox you specify (Default Folders)

Single Mailbox - Which mailboxes does this user or group have access to
Generate reports on a single mailbox -
- Report which mailboxes a particular user or email enabled security group have access to

Global Reports on all mailboxes
- Report globally on all mailboxes that are configured with permissions and who has that access.




--- Administration Pack for Hybrid Environments ---

Hybrid Office 365 Administration Pack - Including scripts and csv files - Link

- Download - Link
- Support Article - Link

This Hybrid Administration Pack includes scripts and csv files to perform the following.
- Automate creation of Local Exchange User mailboxes
- Automate creation of Local Exchange Shared mailboxes
- Automate creation of Local Exchange Room mailboxes
- Automate creation of Local Exchange Equipment mailboxes
- Automate migration of local mailboxes to Office 365
- Automate creation of Office 365 User mailboxes
- Automate creation of Office 365 Shared mailboxes
- Automate creation of Office 365 Room mailboxes      
- Automate creation of Office 365 Equipment mailboxes
- Set Room and Equipment mailboxes to either Booking Delegate or AutoAccept
- Assign Booking Delegates to Room and Equipment mailboxes
- Run Azure AD Connect to sync the mailboxes to Office 365
- Set Full Access permission
- Set Send As permission
- Set Send On Behalf permission
- Set Manager field
- Set CustomAttribute1 - to allow for better Enterprise Administration
- Create Mailboxes in the Active Directory Organizational Unit of your choice



--- Migration preparation scripts to update UPNs to match primary SMTP addresses

Scripts to update UPN to match the user's Primary SMTP email address

- Download - Link
- Support Article - Link

This pack of scripts to update UPN to match the user's Primary SMTP email address consists of five scripts which perform the following.

Script 1 - Get-UPN-SMTP-GroupMember.ps1
- Get csv report of all users in a specific Group and report of User Principal Name and Primary SMTP Address

Script 2 - Get-UPN-SMTP-OU.ps1
- Get csv report of all users in a specific OU and sub OUs and report of User Principal Name and Primary SMTP Address

Script 3 - UpdateUPNviaGroup.ps1
- Update UPN to match the Primary SMTP Address - targeting users in a DL or email enabled security group

Script 4 - UpdateUPNviaOU.ps1.ps1
- Update UPN to match the Primary SMTP Address targeting users in a specific OU or sub OU

Script 5 - SingleUpdateUPN-Manually.ps1
- Used to update a single AD User's UPN to the primary SMTP address that you specify



Complete list of all my tutorials



Configure your Administration PC or Server
How to configure your desktop PC for Office 365 Administration - including MFA - Link
How to configure Server 2012 R2 for Office 365 Administration - including MFA - Link
How to configure your desktop PC for Hybrid Exchange - Office 365 - Azure Administration - Link

Connection Tutorials
How to connect to Office 365 and Azure via PowerShell - Link
How to connect to Hybrid Exchange - Office 365 - Azure AD and Local AD via PowerShell - Link
How to connect to Office 365 via PowerShell with MFA - Multi-Factor Authentication - Link
How to connect to Exchange Online and Azure AD via PowerShell (Basic script) - Link

Connection Scripts - Download Links
Office 365 Connection Script with Modern Auth - Supports MFA (Multi-Factor Auth) - Link
Office 365 and Azure PowerShell Connection Script (No MFA support) - Link
Office 365 Hybrid, Azure and Local Active Directory PowerShell Connection Script - Link
Office 365 Connection Script - Basic (Exchange Online, Azure AD v1 and v2) - Link

All my TechNet Scripts and support articles - Link

Office 365 Migrations
How to configure Exchange 2013 - 2016 for Office 365 Hybrid - Link
How to update user UPNs to match the user's email address - Link
Group Membership Pack for Office 365, Local AD and Exchange - Part 1 - Office 365 - Link
Group Membership Pack for Office 365, Local AD and Exchange - Part 2 - Local - Link

All Hybrid Administration Tutorials
How to configure Exchange 2013 - 2016 for Office 365 Hybrid - Link
How to configure your desktop PC for Hybrid Exchange - Office 365 - Azure Administration - Link
How to connect to Hybrid Exchange - Office 365 - Azure AD and Local AD via PowerShell - Link
Hybrid Management - Part 01 - Creating local User mailboxes - Link
Hybrid Management - Part 02 - Creating local Exchange Shared Mailboxes - Link
Hybrid Management - Part 03 - Creating local Exchange Room and Equipment Mailboxes - Link
Hybrid Management - Part 04 - Configure the Hybrid Connection Wizard - Link
Hybrid Management - Part 05 - Individual mailbox moves via the EAC - Link
Hybrid Management - Part 06 - Bulk mailbox moves via the EAC - Link
Hybrid Management - Part 07 - Moving bulk mailboxes with PowerShell - Link
Hybrid Management - Part 08 - Creating Office 365 User Mailboxes via PowerShell - Link
Hybrid Management - Part 09 - Creating Office 365 Shared Mailboxes via PowerShell - Link
Hybrid Management - Part 10 - Creating Office 365 Room and Equipment Mailboxes via PowerShell - Link

All Modern Authentication and MFA (Multi-Factor Authentication) Tutorials
All my MFA Tutorials on one page - Link
How to configure your desktop PC for Office 365 Administration - including MFA - Link
How to configure Server 2012 R2 for Office 365 Administration - including MFA - Link
How to enable MFA (Multi-Factor Authentication) for Office 365 administrators - Link
How to connect to Office 365 via PowerShell with MFA - Multi-Factor Authentication - Link
How to protect your Office 365 MFA admin account from cell phone SIM hijacking - Link
MFA Support - PowerShell modules and resources for Office 365  - Link
Be prepared for upcoming enforcement of MFA protection for Office 365 Admins - Link

Documentation and Administration Scripts
Group Membership Pack for Office 365, Local AD and Exchange - Part 1 - Office 365 - Link
Group Membership Pack for Office 365, Local AD and Exchange - Part 2 - Local - Link
Exchange Online Configuration Documentation Script - Link
Exchange Org documentation script for auditing and creating As Built docos - Link
Mailbox Permission Pack for Exchange Online and Exchange On-Premises - Link
Hybrid Office 365 Administration Pack - Including scripts and csv files - Link
Scripts to update UPN to match the user's Primary SMTP email address - Link

Security
How to protect your Office 365 MFA admin account from cell phone SIM hijacking - Link
How the Outlook app on the PC helps protect you and your users from phishing emails - Link
Be prepared for upcoming enforcement of MFA protection for Office 365 Admins - Link

Daily Administration and Reports 
How to create a basic document of the Exchange Online environment - Link
How to document the local Exchange Organization for As Built documents and auditing - Link
PowerShell scripts to report on Mailbox permissions in Exchange Online and Exchange On-Prem - Link
Group Membership Pack for Office 365, Local AD and Exchange - Part 1 - Office 365 - Link
Group Membership Pack for Office 365, Local AD and Exchange - Part 2 - Local - Link
Identify which Office 365 groups have been created by Microsoft Teams and their members - Link

Enterprise Management
How to manage Enterprise environments - Part 1 - Filtering queries - Link
How to manage Enterprise environments - Part 2 - Creating scripts with a filtered query - Link
How to manage Enterprise environments - Part 3 - Bulk management using multiple filters - Link
Group Membership Pack for Office 365, Local AD and Exchange - Part 1 - Office 365 - Link
Group Membership Pack for Office 365, Local AD and Exchange - Part 2 - Local - Link
Identify which Office 365 groups have been created by Microsoft Teams and their members - Link

PowerShell scripting
How to create basic PowerShell scripts - Link
How to create basic PowerShell scripts with Export-CSV - Link
How to create basic PowerShell scripts with Import-CSV - Link
How to create PowerShell outputs to show all data without truncation - Link
How to force PowerShell to display all the properties by default - Link
How to force PowerShell to export multi-value properties when exporting to csv files - Link
PowerShell modules and resources for Office 365 - Link

Downloads -
All my PowerShell TechNet Downloads - Link

Tips and Tricks -
How to use Chrome browser for concurrent multiple connections to different Office 365 tenancies- Link
General Tips and Tricks for better Office 365 Administration - Link
How to extend your Office 365 Trial - Link
How to get a 180 day trial tenant in Office 365 for testing - Link
PowerShell modules and resources for Office 365 - Link
How to update user UPNs to match the user's email address - Link
How the Outlook app on the PC helps protect you and your users from phishing emails - Link

Troubleshooting -
Hybrid Connection Wizard and Click to Run applications fail to download and run - Link

Training - 
ALL my training articles - Link
How to access 3 months FREE training for Microsoft Certifications via Pluralsight - Link
How to access 3 months FREE training for Microsoft Certifications via LinkedIn Learning - Link
How to access unlimited free Microsoft Training videos for IT Professionals via EdX - Link
Free Microsoft Training for IT Professionals via Hands On Labs - Link
Office 365 Training Guides - Link - Redirect Link


How to get a 180 day trial tenant in Office 365 for testing



30 day trials just aren't long enough, especially if you are testing a Hybrid configuration.

One of the biggest frustrations for Office 365 Administrators who are trying to learn this awesome technology, is that trial tenants expire after 30 days. This is annoying if you have a cloud only trial environment, but what if you are testing a Local - Hybrid Exchange environment that has taken weeks to configure. It is simply too much effort to create a new trial E3 tenant from scratch, remove your domain from the expired tenant, and then configure your new tenant with domains, users, data, and re-configuring the Hybrid Connection Wizard to continue after the initial 30 day trial.

----- What if I told you that you could get a 180 day free trial on Office 365 -----

Most people know that you can extend your existing Office 365 E3 trial for another 30 days, but did you know you can further extend your existing test environment by assigning an E5 trial, and then extending that? This would give you a total of 120 days testing. After that, you can then assign an Office 365 Business Premium  trial license and extend that as well, giving you a total of 180 days free testing.

By utilising the three Office 365 trials with Exchange Online and extending them, you will get a total of 180 days of free Exchange Online testing.

So how does this work in the real world?

My original 30 day E3 trial expired just over a month ago, and I extended it for another 30 days, using this process.
How to extend your Office 365 Trial - Link

The extended period has just expired as well. Rather than get all upset about having to recreate a new tenant and deprovision the old tenant, I started investigating to see if I was able to assign a trial E5 license to my about to expire (extended) E3 license. And it worked !!!

I am now in my third month of my Office 365 trial. I have spent countless hours over the last three months creating and configuring an Office 365 - Hybrid test environment, and it is re-assuring to know that I do not need deprovision my old tenant and create a new one to keep testing.

Follow the processes below to  create - extend your Office 365 tenant for a total of six months - 

--------------------------------------------------------------------------------------------

Sign up and create your tenant with an E3 license if you haven't already done it -

First thing we need to do is sign up for a standard Office 365 E3 trial. Browse to this web page -
Office 365 Enterprise E3 Trial - Link - And sign up for your E3 trial.
Fill in your personal details making sure that you enter your valid email and international mobile number.

At the Create your user ID page, select your username and tenant name. Note that your tenant name must be unique and cannot be changed once created.









Use your mobile for verification, and voila - You have just created a test tenant with an Office 365 E3 subscription.

Once you log into the Office 365 portal, go to Billing - Subscriptions -



.








You will see that you have an active Office 365 Enterprise E3 trial with 25 licenses available.











------------------------------------------------------------------------------

At the end of your 30 day trial (Enterprise E3) - Extend your trial
How to extend your Office 365 Trial - Link

------------------------------------------------------------------------------

At the end of trial extension - Add a new subscription for a different 30 day trial
- Note that you can actually mix Business Premium Trial and Enterprise E3 Trial
- In the steps below, I am adding an Enterprise E5 trial

To add a new subscription, click on - Add Subscriptions -






You will now be able to add extra subscriptions.

Under the Purchase Services - Enterprise Suite - Highlight Office 365 Enterprise E5 - Start Free Trial











Under Checkout - Confirm your order - Click 'Try Now'













Continue -

Assign your new licences to your existing users and you will extend the subscription by 30 days.

------------------------------------------------------------------------------

At the end of your second 30 day trial (Small Business Suite) - Extend your trial
How to extend your Office 365 Trial - Link

------------------------------------------------------------------------------

At the end of your second trial extension - Add a new subscription for a different 30 day trial
- Note that you can actually mix Business Premium Trial and Enterprise E3 Trial
- In the steps below, I am adding an Business Premium Trial

To add your new subscription, click on -
Billing - Subscriptions -












Add Subscriptions -






Under the Purchase Services - Scroll down to - Small Business Suite - Office 365 Business Premium
- Start Free Trial










Under Checkout - Confirm your order - Click 'Try Now'












Continue -

Assign your new licences to your existing users and you will extend the subscription by 30 days.

------------------------------------------------------------------------------------------

At the end of your third 30 day trial (Business Premium) - Extend your trial
How to extend your Office 365 Trial - Link

-------------------------------------------------------------------------------------------

In my testing I have confirmed that even though the Business Premium trial licenses are Exchange Plan 1 (against E3 and E5 trials being Exchange Plan 2), I had no issues with my Hybrid environment. You will however lose Exchange Plan 2 features when switching to Business Premium (eDiscovery, Litigation Hold etc), so ensure you do the Exchange Plan 2 testing before switching to the Business Premium trial licenses.

-------------------------------------------------------------------------------------------

Extra info -
Here are the direct links to all the available Office 365 Trials

Office 365 Enterprise E3 Trial - Link
Office 365 Enterprise E5 Trial - Link
Office 365 Business Premium Trial - Link

-------------------------------------------------------------------------------------------

Update - 15 May 2017 - Now extended to cover my sixth month
My fifth month of using the Office 365 trials with extensions has now finished. I have now confirmed I can extend my third trial to give me a full 180 day trial.

As the third trial was for an E5 license, I can extend the trial as before.

Under my Subscriptions you can see that the E5 trial has expired and is now in Reduced Functionality mode -










To extend the trial, I click on Billing - Purchase Services
Select the appropriate service (E5), Extend trial.












Select - Next







Select your credit card (no payment will be charged)

Extend trial -

Your trial will now be extended.






The Purchase Services page will update to show that the trial has been extended with a new expiry date.











-------------------------------------------------------------------------------------------

Congratulations !!!
You have now extended your Office 365 trial for the full 180 days.

-------------------------------------------------------------------------------------------

Check out a list of ALL of my tutorials here - Link

How to identify which Office 365 groups (Unified Groups) have been created by Microsoft Teams and their members.



Update 16 September 2018 -

As per this article by Tony Redmond - Link - the ProvisioningOption property returned by the Get-UnifiedGroup is not a clear indicator for determining whether the Office 365 group was created by Teams or another Office 365 service.

I have decided to leave this article published for reference in case the Microsoft Engineering Team use the ProvisioningOption in the future.


=======================================================

Overview -
This tutorial will take you through the steps on how to use my Group Membership script to provide a report that can be filtered to show you all the Office 365 groups (Unified Groups) in your tenant that have been created by Microsoft Teams, as well as their members.

=======================================================


Pre-requisites -


To run these PowerShell scripts, you must first connect to either Exchange Online.

Follow my tutorials and use my Office 365 PowerShell connection scripts to connect to Exchange Online.

Note - You must have the directory - c:\reports - created prior to running the scripts or edit the $logpath variable in the script that generate the group membership reports.


Configure your PC and connect to Exchange Online - see tutorials below
- How to configure your desktop PC for Office 365 Administration - including MFA - Link
- How to connect to Office 365 and Azure via PowerShell - Link
- How to connect to Office 365 via PowerShell with MFA - Multi-Factor Authentication - Link
- Office 365 and Azure PowerShell Connection Script (Non-MFA) - Download Link
- PowerShell Office 365 Connection Script with Modern Auth (with MFA) - Download Link


Follow these tutorials to become familiar with the script and how to export the results.
Only part 1 is needed for creating reports of groups in Office 365 / Azure -

Part 1 - Scripts for Azure AD and Exchange Online Group Membership - Link
Part 2 - Scripts for Local AD and Exchange Group Membership - Link

Download the Group Membership Pack for Office 365, Local AD and Exchange - Download Link
Note that version 1-1 was updated to include the attribute used to filter for Office 365 groups.


Be familiar with filtering the reports in Excel
These reports are useless if you don't know how to get the information you need.
If you don't really understand how to filter information in csv files in Excel, now is the time to learn.
It is strongly recommended you are comfortable on filtering columns in Excel to get the best results.
I will be providing some tips on some filters to apply to get specific results, but it really is up to you to determine how to apply filters to get the information you need.

For tutorials and info on applying Excel filters, check this link - Link

Now that you are familiar with how to run the scripts to create the reports I will focus on applying filters to get the data on Office 365 groups (Unified Groups).

=======================================================

Script Revision - 
The Group Membership Pack for Office 365, Local AD and Exchange was recently updated to include the attribute needed to determine which groups are Office 365 groups (Unified Groups).
If you haven't already downloaded it, download it here.


Revision -
- Only one file updated - O365-EXO-AllUnifiedGroupsAndRecipients-v1-0 - now version 1-1
- Added new group attribute - GroupIsCreatedByMicrosoftTeams - to identify Office 365 groups created by Microsoft Teams

The image below shows the column used to identify if a groups is created by Microsoft Teams -
GroupIsCreatedByMicrosoftTeams.
The actual Unified Group attribute that is captured and exported in the script is - ProvisioningOption

To identify groups that have been created by Microsoft Teams, I have updated my script to create the new column - GroupIsCreatedByMicrosoftTeams -.

Office 365 groups (Unified Groups) created by users in OWA or Planner do not have a value for this attribute, whereas groups created by Microsoft Teams do have a value for this attribute.

I have tested this on two separate tenancies and they both have the same result, the attribute value starts with 'ExchangeProvisioningFlags:' and have different numbers at the end.

=======================================================

Select the script
- Script Name - O365-EXO-AllUnifiedGroupsAndRecipients-v1-x.ps1

Update and run the script
Please ensure you have updated the script if you are exporting the report to a directory other than c:\reports.
Review the pre-requisites if you need to update script.

Once you have run the script, it will generate a csv report named - AllOffice365UnifiedGroupsAndMembers.csv

Reviewing the report
Open the csv file - AllOffice365UnifiedGroupsAndMembers.csv - It will look similar to the image below -










=======================================================

Applying filters to produce the filtered results you desire.

In this tutorial, we are focusing on the groups created by Microsoft Teams.

The image below shows the column used to identify if a groups is created by Microsoft Teams -
GroupIsCreatedByMicrosoftTeams.














As previously mentioned, only groups that are created by Microsoft Teams have a value for the attribute - ProvisioningOption.
This is displayed in the csv column titled - GroupIsCreatedByMicrosoftTeams

To filter the csv to show only groups created by Microsoft Teams, perform the following -
Click the number 1 on the left side of the spreadsheet.
This will highlight row number one

Next - Click the button - Sort & Filter - Filter

Once filtering is enabled, each column will have an arrow which can be used to apply filters.




To apply a filter to only show groups created by Microsoft Team, simply click the arrow on the column named - GroupIsCreatedByMicrosoftTeams -

















Next, click the ticked box - Select all - this will then deselect all entries.

















Next, click the box - ExchangeProvisioningFlags:xxxx
- Note - Each tenant has a different number code















Now that the filter is applied, you will only see groups that were created by Microsoft Teams.
Note that the arrow in the column GroupIsCreatedByMicrosoftTeams has changed to a filter to show that a filter has been applied to that column.













Once filtered, you can view the following attributes of the Groups and Members.
- GroupDisplayName
- GroupEmailAddress
- PublicOrPrivateGroup
- GroupManager
- GroupIsCreatedByMicrosoftTeams
- MemberDisplayName
- MemberEmailAddress
- MemberUserPrincipalName
- MemberExternalEmailAddress
- MemberType
- MemberIsLicensed

=======================================================

Understanding the data.

- GroupDisplayName - This is the Display Name of the group
- GroupEmailAddress - This is the email address of the group
- PublicOrPrivateGroup - This is whether the group is configured as Public or Private



- GroupManager - This is the manager of the group
- GroupIsCreatedByMicrosoftTeams - If the group is created by Microsoft Team, there will be a value
- MemberDisplayName - This shows the display name of each member of the group










- MemberEmailAddress - This is the email address of each member of the group
- MemberUserPrincipalName - This is the User Principal Name of each member of the group
- MemberExternalEmailAddress - This is the email address of any external members of the group










- MemberType - This is what type the member of the group is
- MemberIsLicensed - This shows if the member has been assigned a license or not.










=======================================================

Congratulations... 
You now know how to identify which Office 365 groups (Unified Groups) have been created by Microsoft Teams and their members.

------------------------------------------------------------------------------

Check out a list of ALL of my tutorials here - Link




Group Membership Pack for Office 365, Local AD and Exchange - Part 2 - Local AD and Exchange





This is Part 2 of two parts to this support article for the Group Membership Pack
Part 1 - Scripts for Azure AD and Exchange Online Group Membership - Link
Part 2 - Scripts for Local AD and Exchange Group Membership - Link

Related article -
Identify which Office 365 groups have been created by Microsoft Teams and their members - Link

Group Membership Pack for Office 365, Local AD and Exchange - Download Link

=============================================================

Part 2 - Introduction
After reviewing Part 1 - we now continue to Part 2 - preparing and running the scripts for local AD and local Exchange.

If you are after the preparation and running of the scripts for Azure AD and Exchange Online, please go to Part 1 of these tutorials.

Group Membership Pack for Office 365, Local AD and Exchange
This pack of ten PowerShell scripts will generate csv reports of ALL groups and their members for -
Local AD and Exchange On-premises, including dynamic distribution groups
Azure AD, and Exchange Online, including dynamic distribution groups
Office 365 Groups (Unified Groups).
I have also included scripts to query and export all the groups a single user is a member of in -
Local AD and Azure AD.
Download the Group Membership Pack Link

Group and User Attributes
All my scripts export the most important attributes of both the group and the members, for example, whether the group is synced from on-premises, the email address of the group, whether the groups is public or private (for Unified Groups), etc.

Filtering the reports
Reports are useless if you don't know how to get the information you need.
If you don't really understand how to filter information in csv files in Excel, now is the time to learn.
It is strongly recommended you are comfortable on filtering columns in Excel to get the best results.
I will be providing some tips on some filters to apply to get specific results, but it really is up to you to determine how to apply filters to get the information you need.

For tutorials and info on applying Excel filters, check this link - Link


 =========================================================

 The Group Membership Pack for Office 365,
Local AD and Exchange

Below is a summary of the ten scripts and the functions they perform.

--- Azure AD and Exchange Online Scripts - (See Part 1)

All Azure AD Groups and their members
- Export a csv of all groups in Azure AD and their members (including synced groups via Hybrid)
- Script Name - O365-AAD-AllAdGroupsAndMembers-v-1-x.ps1

Single user group membership 
- Export a csv of all groups a single user is a member of, including Unified Groups (Office 365 groups)
- Script Name - O365-AAD-SingleUserGroupMembership-v-1-x.ps1

All Exchange Online Distribution Groups and their members
- Export a csv of all Exchange Online distribution groups and their members
- Script Name - O365-EXO-AllExchangeDistGroupsAndRecipients-v1-x.ps1

All Exchange Online Dynamic Distribution Groups and their members
- Export a csv of all Exchange Online dynamic distribution groups and their members
- Script Name - O365-EXO-AllExchangeDynamicDistGroupsAndRecipients-v1-x.ps1

All Unified Groups and their members (Office 365 Groups)
- Export a csv of all Unified groups and their members (Office 365 Groups)
- Script Name - O365-EXO-AllUnifiedGroupsAndRecipients-v1-0.ps1



--- Local AD and Exchange on-premises Scripts - (See Part 2)


All Local AD Groups and their members - Scoped to a particular OU and the sub-OUs
- Export a csv of all groups in Local AD and their members
- Script Name - Local-AD-AllAdGroupsAndMembers-OU-v-1-x.ps1

All Local AD Groups and their members
- Export a csv of all groups in Local AD and their members
- Script Name - Local-AD-AllAdGroupsAndMembers-v-1-x.ps1

Single User group membership
- Export a csv of all groups a single user is a member of
- Script name - Local-AD-SingleUser-AllGroupMembership-v-1-x.ps1

All Local Exchange Distribution Groups and their members
- Export a csv of all Local Exchange distribution groups and their members
- Script Name - Local-Exchange-AllExchangeDistGroupsAndMembers-v1-x.ps1

All Local Exchange Dynamic Distribution Groups and their members
- Export a csv of all Local Exchange dynamic distribution groups and their members
- Script Name - Local-Exchange-AllExchangeDynamicDistGroupsAndMembers-v1-x.ps1


=================================================================


Pre-requisites - Local AD and Local Exchange

To run these PowerShell scripts for Local AD and Local Exchange, you must first connect to Exchange On-Premises. 

Note that the Exchange local server needs to import the Active Directory module in PowerShell, so the machine that the scripts run on must have the AD tools installed.

Note - You must have the directory - c:\reports - created prior to running the scripts or edit the $logpath variable in the scripts that generate the group membership reports.

Connect to Exchange On-Premises
Run the scripts from Exchange Management Shell from the Exchange server or a pre-configured Exchange admin machine. You also need to import the Active Directory module for local AD management.


=================================================================

Editing the scripts for log path change

Note that you only need to edit the scripts if you want your reports created in a different folder from the default - c:\reports.

To edit the default report location, perform the following.
Open the script in PowerShell ISE or your favourite script editing program.

Scroll down until you find the section with the variable - $logpath = "c:\reports"








Update the path (if needed), to the path you want your reports generated.








Repeat for all scripts and save the updated scripts for future use.

Confirm that the folder(s) exist on the computer you are running the scripts on.


=================================================================


Editing the script for Local Active Directory Group Membership that is scoped for a particular OU.

Preparation for the script - Local-AD-AllAdGroupsAndMembers-OU-v-1-x.ps1

For this script to target the specific Organizational Unit and the sub-OUs, you will need to update the script variable for the OU. The OU path needs to be in the Distinguished Name format.

The easiest way to do this is to go to Active Directory Users and Computers -
Select the OU that you want the script to query (it will query the sub-OUs as well)
Right click the OU - in this example, right click the OU named Exchange -
Select - Properties.
In the Properties dialogue box, select - Attribute Editor -
Scroll down to the attribute - distinguishedName - Double click the entry.
























Select the highlighted text and copy to a notepad file.










Below you can see the Original script









Copy the Distinguished Name from the notepad file and paste into the script to update the script.

Below you can see the script updated with the distinguished name of the OU









Save the script for later use.


=================================================================

Generating and analyzing the reports

Connect to Local Exchange to run the reports for local AD and local Exchange.

Office 365 - Exchange Online - (Part 1)
- Note that you only run the scripts starting with - Office 365

Exchange Local and AD Local (Part 2)
- Note that you only run the scripts starting with - Local

Select your script -















Process for running the scripts (Local AD and Exchange On-premises)
Open PowerShell and connect to local Exchange (use pre-requisite steps at the top of this article)
Change to the directory that the scripts are located.
Type in the script name - 
Example - Local-AD-AllAdGroupsAndMembers-OU-v-1-x.ps1
Press enter -
The script will run and generate the csv report by default to 'c:\reports' or the folder you updated the script to.

Analyzing and filtering the reports -
Apply filters to each of the csv reports to determine the information you need.
Examples of popular filters to apply to reports will be included with each of the script details below.
Remember to clear the filter in Excel before applying a different filter again.
Multiple filters can be applied.
For tutorials and info on applying Excel filters, check this link - Link


=================================================================

Local Active Directory Group Membership Report Scripts


Script Use - All Local AD Groups and their members - Scoped to a specific OU and the sub-OUs
- Export a csv of all groups in Local AD and their members (Specified OU and sub-OUs)
- Script Name - Local-AD-AllAdGroupsAndMembers-OU-v-1-x.ps1
- Ensure you have updated the script with the DN of the OU you are targeting (see editing section above).


Spreadsheet Columns - The columns below will be generated in the csv spreadsheet -
GroupDisplayName - Shows the display name of the group
GroupScope -  Shows the scope of the group (Universal, Domain Local or Global)
GroupCategory - Shows the type of group (Security or Distribution)
GroupDistinguishedName - Shows the Group's DN. This helps when viewing locations of groups
MemberDisplayName - Shows the display name of the group member
MemberSamAccountName - Shows the SAM account name of the group member
MemberType - Shows the object type of the member (user or computer)
MemberDistinguishedName - Shows the member's DN. This helps when viewing locations of members

Filtering Tips -
Filter by single or multiple GroupDisplayName to see the members of those groups
Filter by single or multiple MemberDisplayName to see what groups they are members of
Filter by GroupCategory to see which groups are security groups and which are distribution
Filter by GroupScope to see which groups are Universal, Domain Local or Global
Use a combination of filters to generate other results.


-----------------------------------------------------------------------------------



Script Use - All Local AD Groups and their members (whole domain) - Not Recommended

- Export a csv of all groups in Local AD and their members
- Note - this script queries the whole domain, not a specific OU and sub-OUs
- Note, this includes computer groups, everything ! Use with caution as it may take hours.
- Script Name - Local-AD-AllAdGroupsAndMembers-v-1-x.ps1

Spreadsheet Columns - The columns below will be generated in the csv spreadsheet -
GroupDisplayName - Shows the display name of the group
GroupScope -  Shows the scope of the group (Universal, Domain Local or Global)
GroupCategory - Shows the type of group (Security or Distribution)
GroupDistinguishedName - Shows the Group's DN. This helps when viewing locations of groups
MemberDisplayName - Shows the display name of the group member
MemberSamAccountName - Shows the SAM account name of the group member
MemberType - Shows the object type of the member (user or computer)
MemberDistinguishedName - Shows the member's DN. This helps when viewing locations of members

Filtering Tips -
Filter by single or multiple GroupDisplayName to see the members of those groups
Filter by single or multiple MemberDisplayName to see what groups they are members of
Filter by GroupCategory to see which groups are security groups and which are distribution
Filter by GroupScope to see which groups are Universal, Domain Local or Global
Use a combination of filters to generate other results.


-----------------------------------------------------------------------------------



Script Use - Single User group membership

- Export a csv of all groups a single user is a member of
- Script name - Local-AD-SingleUser-AllGroupMembership-v-1-x.ps1

Note - The script will prompt for the alias of the local AD User
Enter the alias and then press enter




The generated script will be named with the user alias as the start of the csv file name -







Spreadsheet Columns - The columns below will be generated in the csv spreadsheet -
Name - Shows the display name of the group
GroupCategory - Shows the category of the group (Security or Distribution)
GroupScope - Shows the scope of the group (Universal, or Global)
DistinguishedName - Shows the DN of the group


-----------------------------------------------------------------------------------

Local Exchange Group Membership Report Scripts


Script Use - All Local Exchange Distribution Groups and their members

- Export a csv of all Local Exchange distribution groups and their members
- Script Name - Local-Exchange-AllExchangeDistGroupsAndMembers-v1-x.ps1

Spreadsheet Columns - The columns below will be generated in the csv spreadsheet -
GroupDisplayName - Shows the display name of the group
GroupEmailAddress - Shows the email address of the group
GroupOU - Shows the Organizational Unit where the group is located in AD
MemberDisplayName - Shows the display name of the group member
MemberEmailAddress - Shows the email address of the group member
MemberExternalEmailAddress - Shows the external email address (address for routing to cloud)
MemberSamAccountName - Shows the SAM account name of the member
MemberType - Shows the Exchange recipient type
MemberOU - Shows the Organizational Unit where the member is located in AD


Filtering Tips -
Filter by single or multiple GroupDisplayName to see the members of those groups
Filter by single or multiple MemberDisplayName to see what groups they are members of
Filter by MemberType to see which members are groups or cloud mailboxes or on-prem mailboxes
- UserMailbox shows mailboxes that are hosted in local Exchange
- RemoteUserMailbox shows mailboxes that are hosted in Office 365

Use a combination of filters to generate other results.

Visual tips -
Check the GroupOU and MemberOU columns visually for odd locations. This may help you troubleshoot user issues with users or groups not in the OUs that are targeted for Azure AD syncing.


------------------------------------------------------------------------------


Script use - All Local Exchange Dynamic Distribution Groups and their members

- Export a csv of all Local Exchange dynamic distribution groups and their members
- Script Name - Local-Exchange-AllExchangeDynamicDistGroupsAndMembers-v1-x.ps1

Spreadsheet Columns - The columns below will be generated in the csv spreadsheet -
GroupDisplayName - Shows the display name of the group
GroupEmailAddress - Shows the email address of the group
GroupManagedBy - Shows the canonical name of the group manager
MemberDisplayName - Shows the display name of the group member
MemberEmailAddress - Shows the email address of the group member
MemberExternalEmailAddress - Shows the external email address (for routing to external addresses)
MemberType - Shows the Exchange recipient type


Filtering Tips -
Filter by single or multiple GroupDisplayName to see the members of those groups
Filter by single or multiple MemberDisplayName to see what groups they are members of
Filter by MemberType to see which members are groups or cloud mailboxes or on-prem mailboxes
- UserMailbox shows mailboxes that are hosted in local Exchange
- RemoteUserMailbox shows mailboxes that are hosted in Office 365

Use a combination of filters to generate other results.

------------------------------------------------------------------------------

Congratulations... 
You now know how to use the second part of the Group Membership Pack for Office 365, Local AD and Exchange.

Continue to Part 1 - Scripts for Azure AD and Exchange Online Group Membership - Link

------------------------------------------------------------------------------

Check out a list of ALL of my tutorials here - Link