Office 365 – One PowerShell to rule them all – WRONG [EN]

When i started digging deeper into some aspects of Office 365 i have discovered an interesting and a bit weird (in my opinion) thing. It wasn’t a surprise that some advanced changes are only possible via PowerShell (Microsoft is pushing its shell for many years). But there is no unified, single PowerShell module to manage all the services. You almost have to install and use a separate module for every service. Some of them have different procedures to login. That’s a jarring experience. I will try to describe a few of them that might be useful. Especially when dealing with support, which often asks for an output for some PShell commands on your tenant. Personally i install them all on the same server running Azure AD Connect, as none of my workstations were running 64-bit OS at the moment (and many of these modules, if not all, require x64) and i decided to keep everything related to Office 365 in one place.

Skype for Business Online PowerShell Module

Download: https://www.microsoft.com/en-us/download/details.aspx?id=39366
Installation is straightforward. But it doesn’t create a shortcut like some other modules do. So you have to run a regular PowerShell window and enter these commands:

Import-Module LyncOnlineConnector
$userCredential = Get-Credential
$sfbSession = New-CsOnlineSession -Credential $userCredential
Import-PSSession $sfbSession

At some point during running these commands it shows a login window, in which you should put your tenant admin’s credentials.

More information: https://technet.microsoft.com/en-us/library/mt614245.aspx


SharePoint Online Management Shell

Download: https://www.microsoft.com/en-us/download/details.aspx?id=35588

It allows managing both SharePoint Online and OneDrive for Business settings. After the installation you can run search by “sharepoint” and find the shortcut (pin or copy it). After running this shortcut you should run this command:

Connect-SPOService

It then prompts for the URL. You should put: https://tenant-admin.sharepoint.com and it then should show a login window, in which you should put your tenant admin’s credentials.

More information: https://technet.microsoft.com/en-us/library/fp161388.aspx


Azure AD PowerShell Module

Download: http://connect.microsoft.com/site1164/Downloads/DownloadDetails.aspx?DownloadID=59185 (not available anymore as Connect is closed and there is no alternative link to download it)

After you install this module, it creates its own shortcut, but it is not using the usual PowerShell color scheme and looks like basic CMD console.

To connect to your tenant use this command:

Connect-MSOLService

It should then show a login window where you should provide your tenant admin’s credentials.

More information: https://blogs.technet.microsoft.com/enterprisemobility/2015/10/20/azure-ad-powershell-public-preview-of-support-for-azure-mfa-new-device-management-commands/


Exchange Online PowerShell Module

Installation: as i’ve said before, i wasn’t able to install some of the modules on my workstation, so i have installed them all on the same server running Azure AD Connect. To install this one on the same server open a browser window and go to your Office 365 Admin center > admin centers menu in the left panel > Exchange admin center > Hybrid (this might change once we are not in the hybrid mode anymore) > press the second Configure button (besides the “Exchange Online PowerShell Module supports”. It then should show the Install button. After the installation it puts a shortcut on the desktop. After launching this shortcut you should run this command:

Connect-EXOPSSession

In the login window enter your tenant admin’s credentials.

More information: https://technet.microsoft.com/en-us/library/jj200780(v=exchg.160).aspx

UPDATE: Actually, it seems that there is probably a way to use one PowerShell console and install all the needed modules on the fly via PowerShell commands, but it might require having Windows 10 or Windows Server 2016 as older systems might not support such out of the box modules. Then separately installed modules (described above) can be used. Microsoft is actually updating some of them (like SharePoint Online or Skype for Business modules). But some are not available anymore, like Azure AD one, as Microsoft has closed its Connect community.

Leave a Reply

Your email address will not be published. Required fields are marked *