‘Deep Dive’ into Office 365 PowerShell cmdlets: Summary

As powerful as Office 365 is, it can be made even more powerful with simple PowerShell cmdlets that can streamline your work and make your life easier. In today’s “Deep Dive,” we summarize the past 10 articles in our series while looking ahead to the next few articles.

We have already spoken about Get-MsolUser and Get-MsolGroup PowerShell cmdlets in a greater detail in previous parts of this article series. Get-MsolUser is a commonly used PowerShell cmdlet by many Office 365 admins and it helps you reduce the time it takes to perform Office 365 user management tasks via Office 365 Admin Center. Before we deep dive into PowerShell cmdlets that you can use to manage other aspects of an Office 365 tenant such as Exchange Online, SharePoint, and Lync services, we would like to provide an overview of the series so it is easy for you to jump into the articles you are interested in to read more about. Here is a quick look back.

In Part 1, we gave you an overview of Office 365 PowerShell. We explained that in order to interact with Office 365 services, you will be required to use different PowerShell modules. For example, in case you need to interact with Windows Azure Active Directory (or WAAD), you will be required to install Windows Azure Active Directory Module for Windows PowerShell. Similarly, in case you need to manage Exchange Online, you are required to install Exchange Online PowerShell Modules. We will explain how to manage Exchange Online using Exchange Online PowerShell Modules in the next part of this article series. We finished Part 1 by explaining the PowerShell modules available to manage WAAD.

Part 2 focused on the list of PowerShell cmdlets available with WAAD and how easy it is to get a list of PowerShell modules by using the Get-Command PowerShell cmdlet. For example, in case you needed to retrieve a list of PowerShell cmdlets for use with WAAD, you could execute these commands:

Get-Command -Noun MSol* | Select-Object Name, DLL | Export-CSV AllMSOnLineCmdlets.CSV –NoTypeInformation

Get-Command -Noun MSol* | Select-Object Name, DLL > AllMSOnLineCmdlets.Txt

In Part 2, we also explained the first command that you need to use before you start to use other WAAD PowerShell cmdlets. You will be required to connect to an Office 365 tenant by using the Connect-MsolService cmdlet.

The focus of Part 3 is geared primarily toward managing Office 365 users by using Get-MsolUser PowerShell cmdlet. Using Get-MsolUser PowerShell cmdlet, you can interact with the Office 365 users in an Office 365 tenant. The Get-MsolUser PowerShell cmdlet plays an important role when performing Office 365 user management tasks such as collecting a list of users, resetting user passwords, collecting unlicensed users, and managing other aspects of Office 365 users. We explained an important parameter of Get-MsolUser PowerShell cmdlet, which is “-MaxResults” parameter. You need to use “-MaxResults” parameter only if you have more than 500 users in an Office 365 tenant. If there are more than 500 users and if you need to perform an operation against all Office 365 users, you will use “-All” parameter. You might want to check Get-MsolUser PowerShell commands that we have explained to interact with Office 365 users.

In Part 4, we explained important properties of Get-MsolUser PowerShell cmdlet. Get-MsolUser PowerShell cmdlet supports a number of user properties, but the properties that you may find useful, such as AlternateEmailAddress, Department, IsLicensed, LastDirSyncTime, Licenses, OverallProvisioningStatus, PasswordNeverExpires, StrongPasswordRequired, have been explained in a Table of Part 4. As explained in Part 4, when exporting the output of Get-MsolUser command to a CSV file, Get-MsolUser cmdlet exports all properties of a user unless you specify the property names in the command. For example, if you use below command, values of all properties will be exported to the CSV file.

Get-MsolUser –All | Export-CSV C:\Temp\O365Users.CSV

In case you need to export the values of specific properties, you will be required to supply the property names in the Get-MsolUser PowerShell command as shown below:

Get-MsolUser –All | Select-Object DisplayName, City, IsLicensed, SignInName | Export-CSV C:\Temp\AllUsers.CSV -NoTypeInformation

Part 5 explained a few important Get-MsolUser PowerShell commands. While you may find predefined parameters with Get-MsolUser cmdlet useful, predefined parameters might not be useful when you need to collect information such as Office 365 plan and services assigned to users, creation date and time of users and other information such as password expiry information. As explained in Part 5, an important task every Office 365 administrator performs is to collect licenses assigned to Office 365 users. We explained how Get-MsolUser cmdlet becomes an important cmdlet when collecting Office 365 licensing information for specific or all Office 365 users. You could use IsLicensed property, which might help you know whether a user has an Office 365 license assigned or not, but IsLicensed property will not help you know the actual Plan and Licenses assigned to Office 365 users. That’s why we explained the use of “Licenses” property in Part 5. All you need to do is use the “-ExpandProperty” parameter to collect Office 365 Plans and Services assigned to a particular or all Office 365 users as shown in the command below:

Get-MsolUser –UserPrincipalName [email protected] | Select-Object –ExpandProperty Licenses

In Part 6Part 7, and Part 8 we continued to explain some more useful commands of Get-MsolUser PowerShell cmdlet. In Part 7, we explained four types of operations that you can perform using Office 365 PowerShell cmdlets and how you can use the Get-Command cmdlet to retrieve the list of PowerShell cmdlets that you can use to perform a specific operation. For example, “Get-Command New-Msol* | Select-Object Name” will give you a list of PowerShell cmdlets that you can use to perform “collect” operation. You can find more information on the four types of operations and commands to retrieve the list of cmdlets in Part 7.

In Part 9, we provided a PowerShell script that you can use to collect the health status of groups that sync from On-Premises Active Directory.

And in Part 10,  we explained how you interact with Office 365 groups using Get-MsolGroup PowerShell cmdlet. We provided handy PowerShell commands and scripts to collect Office 365 group information.

Coming attractions

In next parts of this article series, we will explain Office 365 PowerShell cmdlets that you can use to manage other aspects of an Office 365 tenant.

About The Author

Leave a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top