Windows PowerShell Can Reveal "Hidden" Information Not Available in the Admin Center

 

Topic Last Modified: 2014-06-09

Sometimes there’s more to Office 365 than meets the eye. (Or, if you will, more than meets the UI.) For example, the Admin center displays a lot of very useful information, but that doesn’t mean that it displays all the information.

What do we mean by that? Well, suppose you’re in the Office 365 section of the Admin Center and you click users and groups. Do that and, by default, you’ll see information about all your active Office 365 users:

The Office 365 Admin center.

What’s wrong with that? Nothing; that’s very useful information. Of course, it’s also true that the only information shown for each user is the user’s display name, user name, and his or her current status. And what’s wrong with that? Again, nothing’s wrong with that: those are all bits of information you need to know.

Nevertheless, there are other pieces of information that might be useful to know from time-to-time. For example, Office 365 licensing (as well as the Office 365 features available to a user) depend in part on that user’s geographic location: the policies and features you can extend to a user who lives in the US might not be the same as the policies and features you can extend to a user who lives in India or in Belgium. Can you use the Admin Center to determine a user’s geographic location? Of course you can. All you have to do is:

  1. Double-click the user’s Display Name.

  2. In the user properties display pane, click details.

  3. In the details display, click additional details.

  4. Scroll down until you see the heading Country or region:

    Office 365 user settings.
  5. Write the user’s display name and location on a piece of paper, or copy and paste it into Notepad. (Unless you think you can remember the display name and location for all of your users.)

See how easy that is? And then you just have to repeat the process for the next user. And the user after that. And ….

Security noteSecurity Note:
And hope that you have less than 1,000 users. That’s because the Admin Center can only display a maximum of 1,000 user accounts at a time. If you have, say, 2,000 users, you’ll need to figure out a way to display the first thousand users, then figure out a way to display the second thousand users.

Will that work? Yes, it will work. Will that be tedious and time-consuming? Yes, it will be very tedious and time-consuming. But what choice do you?

As it turns out, you have this choice:

Get-MsolUser | Select-Object DisplayName, UsageLocation

That simple Windows PowerShell command (which requires you to install the Windows Azure Active Directory module) will display information similar to this, and display it for all your users (even if you have 2,000 of them):

DisplayName                               UsageLocation
-----------                               -------------
Zrinka Makovac                            US
Bonnie Kearney                            GB
Fabrice Canel                             BR
Brian Johnson (TAILSPIN)                  US
Anne Wallace                              US
Alex Darrow                               US
David Longmuir                            BR

But wait: it gets even better than that. Maybe you’d like to sort these users by their location, grouping all the Brazilian users together, all the US users together, etc. Can Windows PowerShell do that? Do you even have to ask? Try this command:

Get-MsolUser | Select-Object DisplayName, UsageLocation | Sort-Object UsageLocation, DisplayName

That returns data similar to this:

DisplayName                                 UsageLocation
-----------                                 -------------
David Longmuir                              BR
Fabrice Canel                               BR
Bonnie Kearney                              GB
Alex Darrow                                 US
Anne Wallace                                US
Brian Johnson (TAILSPIN)                    US
Zrinka Makovac                              US

And if you only want to see information about users based in Brazil, try this command:

Get-MsolUser | Where-Object {$_.UsageLocation -eq "BR"} | Select-Object DisplayName, UsageLocation 

And here’s what you’ll get back:

DisplayName                                           UsageLocation
-----------                                           -------------
David Longmuir                                        BR
Fabrice Canel                                         BR

We told you it was easy.

A Quick Note Regarding Larger Domains

If you have a very large domain, says with tens of thousands of users, some of the examples we show in this introductory article could lead to “throttling.” That means that, based on things like computing power and available network bandwidth, you’re trying to do a little too much at one time. Because of that, larger organizations might want to split some of these Windows PowerShell commands into two commands. For example, this one command returns all the user accounts and shows the DisplayName and UsageLocation for each user:

Get-MsolUser | Select-Object DisplayName, UsageLocation

That works great for smaller domains. In a large organization, however, you might need to split that into two commands: one command to return the user accounts (and store that user account information in a variable) and the other to then display the returned information:

$x = Get-MsolUser
$x | Select-Object DisplayName, UsageLocation


Next: Office 365 has Features That You Can Only Configure by Using Windows PowerShell

 
Show: