Manage Office 365 Users Using PowerShell

This week I wanted to start my second coverage of Office 365 but this time focus on identity management using PowerShell and the Get-MsolUser cmdlet.

Before we start make sure you download and connect to Office 365 using PowerShell using the article I have published Connect And Manage Office 365 Using PowerShell.

To view all active users In Office 365 type:

Get-msoluser -all

To search my name with minimum details type:

Get-MsolUser -SearchString "david"

You can search for users using the following criteria:

Get-MsolUser -UserPrincipalName
Get-MsolUser -ObjectId

To get all licensed users type:

Get-MsolUser -All | where {$_.isLicensed -eq $true}

And you can also change this to show all unlicensed users

Get-MsolUser -All -UnlicensedUsersOnly

And to count all unlicensed users type:

Get-MsolUser -All -UnlicensedUsersOnly | measure


Posted

in

by