Office 365 PowerShell remoting the basics

by Arman Obosyan 30. January 2014 21:29

Office 365 is designed to be very oriented to Windows PowerShell and in fact that not all administration tasks are available through the Office 365 Administration Portal’s Graphical User Interface (GUI), but they are all available through PowerShell. Therefore, Windows PowerShell is the superset administration tool and a definite requirement in your toolkit.

In addition of PowerShell we also need Windows Azure AD Module and Windows PowerShell Integrated Scripting Environment (ISE)

Before we download and install Windows Azure AD Module we need to install Microsoft Online Services Sign-in Assistant.

Download Online Services Sign-in Assistant latest version from here. After you will install it next we need to install Windows Azure AD Module you can download latest from here read latest updates in documentation.

OK, after downloading and installing all components lets try to connect to our Office 365 subscription there is no difference in connection and using in Trial or Regal Subscription, if you do not have subscription yet, register your trial from here 

Find in programs or on your desktop Windows Azure Active Directory Module for Windows PowerShell and run it.

All we need to connect to our Office 365 is:

$cred = Get-Credential
Connect-MsolService -Credential $cred

after entering you credentials, lets try some command, lets check our subscription status


So that’s all, we are connected from PowerShell, you can also save command to .ps1 file for later use, and do not forgot to Set-ExecutionPolicy –ExecutionPolicy Unrestricted otherwise you will get errors running .ps1 file.

The same way you can use commands and script that you saved in .ps1 in Windows PowerShell Integrated Scripting Environment (ISE). We will use later PowerShell ISE for easy management.

For administering Exchange you might want to import cmdlets 

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $Cred -Authentication Basic –AllowRedirection
Import-PSSession $Session

It is important that you close a PSSession after you are done. The reason for closing a PSSession is because of the connection limit in place as a security measure. If you do not close a PSSession, you will need to wait for the session to time out. If there are five sessions of PSSession open, you will not be able to establish additional sessions

Remove-PSSession $Session

That’s it for now I will continue post about PowerShell and Office 365

In addition try this Office 365 Helper Scriptsit will help you to understand and prepare for future advanced administering of Office 365



Pingbacks and trackbacks (1)+

Comments are closed

© 2008-2012, Arman Obosyan, Postmaster.GE
Powered by BlogEngine.NET
Hosted on Windows Azure and IIS8

About the author

Arman Obosyan have more than 20+ years’ work experience in Information Technologies sector.

Last few years he working on a position Technology Strategist at Microsoft Corporation, In the past Arman was Head of IT Infrastructure in Governmental Central Bank of Georgia (National Bank of Georgia).

Nowadays Arman is supporting C-Level and enabling business, visionary with a passion of technology, trends.


Certified since 2003 year, passed following certifications MCP, MCSA, MCSE, MCTS, MCITP, Exin ITIL and VMware Certified Professional (VCP)

Founder / Lead of Microsoft Certified Professionals (MCP) Club Tbilisi and Community GE project 

In 2010 Was awarded a Microsoft Most Valuable Professional (MVP)

2017 MVP Reconnect


The opinions expressed herein are my own personal opinions and do not represent anyone else's view in any way, including those of my employer.

Live Trafic



<<  January 2021  >>

View posts in large calendar