Introduction to Office 365 PowerShell

Office 365 PowerShell is used to perform Office 365 admin center tasks from the command line. Generally, we manage our Office 365 accounts and licenses in Office 365 Admin center. In Office 365 Powershell, it is feasible to manage our Office 365 server products such as Exchange, Skype for Business Online and SharePoint Online. In Office 365 PowerShell, it is easy to manage your Office 365 admin center settings from the command line.

Protect Your Data with BDRSuite

Cost-Effective Backup Solution for VMs, Servers, Endpoints, Cloud VMs & SaaS applications. Supports On-Premise, Remote, Hybrid and Cloud Backup, including Disaster Recovery, Ransomware Defense & more!

Office 365 Powershell Connectivity

Office 365 Powershell connectivity has three simple steps.

  1. Install required software
  2. Run required software
  3. Connect with Office 365 organisation

Supporting Windows versions for Office 365 PowerShell connectivity

Download Banner

Windows 64-bit version is only applicable for Office 365 PowerShell connectivity. Supporting Windows 64-bit versions are listed below

  • Windows 10, Windows 8.1, Windows 8 or Windows 7 Service Pack 1 (SP1)
  • Windows Server 2012 R2, Windows Server 2012, or Windows Server 2008 R2 SP1

Office 365 PowerShell installation in Windows 10

Let us see the Office 365 PowerShell installation steps in Windows 10.

  1. Install required software
  2. Microsoft Online Services Sign-In Assistant for IT Professionals RTW

    The Microsoft Online Services Sign-In Assistant provides end user sign-in capabilities to Microsoft Online Services, such as Office 365.

  3. Run required software
    • In Desktop screen, Windows Azure Active Directory Module for Windows PowerShell is Ready to use
    • Just click it and open Powershell module
  4. Connect with our office 365 organisation

Two types of connectivity are preferred to connect with Office 365

  1. Connect with Username and Password
  2. Connect with Multi-factor authentication
  1. Connect with Username and Password
    • If wish to connect with username and password, run this PowerShell command
    • $UserCredential = Get-Credential
    • Enter your Office 365 work or school account username and password and click OK
    • Office 365 in Windows 10 using Powershell

    • Once credential is verified successfully, then run MsolService PowerShell command to connect Azure Active Directory

    MsolService- This cmdlet attempts to initiate a connection to Azure Active Directory

    Connect-MsolService -Credential $UserCredential

    Office 365 in Windows 10 using Powershell

  2. Connect with Multi-factor authentication
    • Multi-factor authentication increases the security of user logins for cloud services
    • Open Powershell and run this command
    • Connect-MsolService
    • Enter Office 365 Credential to Sign in Azure Active Directory Powershell
    • Office 365 in Windows 10 using Powershell

    • If does not receive any error, then Powershell is successfully connected

Domain Status

  • To view the configuration information for the accepted domains in your organization run this command
Get-AcceptedDomain

Office 365 in Windows 10 using Powershell

Set-ExecutionPolicy

  • Execution Policy is a part of the security strategy of Windows PowerShell
  • Set-ExecutionPolicy cmdlet changes the user preference for the Windows PowerShell execution policy
  • To change Execution policy option start Windows PowerShell with “Run as administrator” option
  • By default, Set-Execution policy is in restricted state. The Restricted setting is written to the registry because it conflicts with a group policy, it is not effective, even though it is more restrictive than the group policy
  • To change ExecutionPolicy state as remote, run this PowerShell command
  • Set-Executionpolicy RemoteSigned

    Office 365 in Windows 10 using Powershell

    Connect to Exchange with Online

    To connect Exchange with online, import exchange online module. Run below command in PowerShell module.

    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri “https://ps.outlook.com/powershell- -Credential $LiveCred
    -Authentication Basic -AllowRedirection
    • Then, URI connection redirecting warning message is displayed
    • URI-Uniform Resource Identifier (URI) is a string of characters used to identify a resource.

      Office 365 in Windows 10 using Powershell

    • To import Exchange PowerShell session, run this PowerShell command
    • Import-PSSession $Session

      Office 365 in Windows 10 using Powershell

    • To view Exchange status, run this PowerShell command
    Get-PSSession

    Office 365 in Windows 10 using Powershell

    Connect to Skype for Business Online

    Skype for Business online connectivity is different from Office 365 because Skype for Business online command is not installed by default. When you sign in, cmdlet is temporarily copied to our computer. When you sign off, those cmdlets are then removed from your computer.

    To connect Skype for Business Online, Import Skype for Business Online module.

    Import-Module Skype OnlineConnector
    $sfbo Session = New-CsOnlineSession -Credential $credential
    • Enter User Credential to access Skype for Business online
    • Office 365 in Windows 10 using Powershell

    • To view, Skype Online Connector details run below PowerShell command
    Get-Module

    Office 365 in Windows 10 using Powershell

    Conclusion

    Office 365 using Powershell is simple to install with less time utilization.

    Follow our Twitter and Facebook feeds for new releases, updates, insightful posts and more.

    Rate this post