How to View Office 365 User Account Details in PowerShell

In this article, I'll show you to retrieve Office 365 user account details with the help of PowerShell.

Prerequisites

Download and install the following modules.

  1. Microsoft Online Service Sign-in Assistant for IT Professionals RTW
  2. Windows Azure Active Directory Module for Windows PowerShell (64-bit version)

View Office 365 User Account Details in PowerShell

- Open PowerShell with elevated privileges.

- Execute the following command. When you are prompted, enter your O365 global admin account or an account having required privileges.

$credential = Get-Credential

- Execute the following command to connect to O365.

Connect-MsolService -Credential $credential

- Execute the following command

Get-MsolUser -UserPrincipalName "<User account name>" | Select-Object *

For example, to get the details of "Belinda" user, you should issue following command.

Get-MsolUser -UserPrincipalName "[email protected]" | Select-Object *

You can filter out some of the properties by issuing following similar command.

Get-MsolUser -UserPrincipalName "<User account name>" | Select-Object DisplayName, Department, UsageLocation

 

Leave a Comment

*