Windows PowerShell Lets You Do \\"Cross-Product\\" Management

 

The different components that make up Office 365 are designed to work together, and, for the most part, they do just that. For example, suppose you add a new user to Office 365 and, when you do, you specify such information as the user’s department and phone number. That information will then be available if you access the user’s information using any of the Office 365 server products: Lync Online, Exchange, or SharePoint Online. You don’t have to set the phone number for Office 365 only to then have to set that phone number again for Lync Online, again for Exchange, and yet again for SharePoint Online.

But that’s for generic information that spans the suite of products. When it comes to product-specific information – for example, information about a user’s Exchange mailbox -- well, information like that is typically not available across the suite. Do you want to know if a user’s mailbox is enabled or not? That information is available only in the Exchange Admin center. And that makes sense: why would you expect the SharePoint Online Admin center to display Exchange information?

That’s all perfectly fine … most of the time. However, suppose you’d like to make a report that shows the following information for all your users:

  • The user’s display name

  • Whether the user is licensed for Office 365

  • Whether the user’s Exchange mailbox has been enabled

  • Whether the user is enabled for Lync

How do you do that quickly and easily compile such a report from within the Office 365 Admin center? To be honest, you don’t. Instead, you’ll have to get all the user names and licensing information from the Office 365 Admin center; then get mailbox information from the Exchange Admin center; then get Lync Online information from the Lync Online Admin center; and then somehow collate and combine that information. A somewhat daunting task, to say the least.

On the other hand, you could just use Windows PowerShell to compile that report for you.

The following little script is, admittedly, a little more complicated than most of the sample code we’ve looked at in this article. But don’t worry about that: remember, our purpose here is to let you know that certain things can be done, not necessarily to explain how to do them. That said, consider the following:

$x = Get-MsolUser

foreach ($i in $x)
    {$y = Get-Mailbox -Identity $i.UserPrincipalName
     $i | Add-Member -MemberType NoteProperty -Name IsMailboxEnabled -Value $y.IsMailboxEnabled

     $y = Get-CsOnlineUser -Identity $i.UserPrincipalName
     $i | Add-Member -MemberType NoteProperty -Name EnabledForLync -Value $y.Enabled}

$x | Select-Object DisplayName, IsLicensed, IsMailboxEnabled, EnabledforLync

Can a simple little script like that really cut across all the Office 365 products and return a report that combines information from three different data sources? See for yourself:

DisplayName             IsLicensed   IsMailboxEnabled   EnabledForLync
-----------             ----------   ----------------   --------------
Zrinka Makovac          True         True               True
Bonnie Kearney          True         True               True
Fabrice Canel           True         True               True
Brian Johnson           False        True               False
Anne Wallace            True         True               True
Alex Darrow             True         True               True
David Longmuir          True         True               True
Katy Jordan             False        True               False
Molly Dempsey           False        True               False

Is That It?

No, not really: in fact,, the sky is the limit when it comes to using Windows PowerShell manage Office 365. And, with that in mind, we’ve put together a resource center (Windows PowerShell in Office 365) that will make it easier for you to find both generic information on Office 365 itself and on Windows PowerShell for Office 365. That should help getting started using Windows PowerShell as a management tool for Office 365, regardless of your current level of Windows PowerShell experience and/or expertise.

See Also

Six Reasons Why You Might Want to Use Windows PowerShell to Manage Office 365