O365 and PowerShell Part II (Why, more power of course)
Why PowerShell I Already Have an Admin Console?
As I was going through all the trouble to setup my environment, get spun up on remoting, and finally fumbling through making my connections, this question occurred to me.
I found the following:
The console was limited in what information I could see.
What I got here is a quick side by side compare the properties I have accessible from O365 admin console and what I am able to pull up by running a quick Get-MSOLUser | Get-Member –MemberType Properties command.
Features only PowerShell Can Configure
As a former SharePoint administrator\developer this is very common. In SharePoint there are tons of features and modifications that can be made only through PowerShell. The following example is looking at what is available through the Lync Admin center vs. PowerShell. Specifically modifications to the default meeting settings, who are presenters by default, recording capability, and admission of anonymous users.
Online the only options I have are to make modifications to the URLs, display of presence information, and authorize users, on the left I within PowerShell I am able to modify the meeting configuration to deny anonymous users, designate presenters, and disable recording with the following command: Set-CsMeetingConfiguration –AdmitAnonymousUsersByDefault $false –AllowConferenceRecording $false –DesignateAsPresenter “None”.
In SharePoint online, as on premises to remove a users access from one or more sites can be a nontrivial event. Using PowerShell this operation can be performed as follows:
More Advanced Filtering
Exchange Online Admin site allows you to lookup users add columns to the mailbox and do some basic filtering. I was curious about finding users in certain cities. After about a dozen clicks I was able to find the users mailboxes, add the city column and sort, that was it. Restricting down to certain locations I was not able to do. PowerShell it was a one line command
Print and Save
PowerShell provides the ability to print and save data, which you could then open as a spreadsheet to do some basic or advanced reporting your choice.
In this example we get all Lync Users filter down to Display Name, User Principal Name, and Usage Location, send it to a comma delimited file.
Cross product management
Let’s say you want to take some data from Exchange Online, O365, Lync, and SharePoint. Open several Internet Explorer Windows and bounce around after dozens of clicks and a lot of back and forth you may have the answer in an hour or more. Or you can just open PowerShell connect to Exchange online, Sharepoint Online, Lync Online, and O365 and run a pretty simple PowerShell query.
$users = Get-MsolUser
foreach ($user in $users )
# Get and set the mailbox property
$mailbox = Get-Mailbox -Identity $user.UserPrincipalName
$user | Add-Member -MemberType NoteProperty -Name IsMailboxEnabled -Value $mailbox.IsMailboxEnabled
# Get and set the Lync Property
$lync = Get-CsOnlineUser -Identity $user.UserPrincipalName
$user | Add-Member -MemberType NoteProperty -Name enabledForLync -Value $lync.enabled
$sharePoint = Get-SPOUser -LoginName "alans@<o365Domain>.onmicrosoft.com" -Site https://<o365Domain>.sharepoint.com
$user | Add-Member -MemberType NoteProperty -Name SharePointAdmin -Value $sharePoint.IsSiteAdmin
$user | Add-Member -MemberType NoteProperty -Name EnabledSharePoint -Value $IsMemberMainSite
# Display my report who is licensed, has a mailbox and is enabled for lync
$user | select DisplayName, Islicensed, IsMailboxEnabled, EnabledForLync, SharePointAdmin
Six Reasons Why You Might Want to Use Windows PowerShell to Manage Office 365: http://technet.microsoft.com/en-us/library/dn568034.aspx