Connecting to Exchange Online using PowerShell

Exchange Online is part of the Office 365 Suite. The Exchange Online Management Center is used to manage and maintain the Exchange online mailboxes. Power Shell can also be used to accomplish these tasks. In order to connect to Exchange Online using Windows Power Shell, one would have to follow these steps-


  1. Run Windows Power Shell as an Administrator.
  2. Run this cmdlet Set-ExecutionPolicy RemoteSigned
  3. $UserCredential= Get-Credential
  4. A Windows PowerShell dialog box would pop up, type in your Office 365 Credentials.
  5. Then run this cmdlet $Session= New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $UserCredential -Authentication Basic -AllowRedirectionScreenshot (117).png
  6. Import-PSSession $Session
  7. Once you have completed your work, you can close the session by Remove-PSSession $Session

Connecting to Skype for Business Online using PowerShell

Skype for Business is used by organizations as a means for communication. Management operations can be performed on the Skype for Business Admin Center. Sometimes you might need to perform bulk operations at a time. In that case one would have to use Power Shell in order to connect to Skype for Business Online and accomplish the tasks.


  1. Download and Install the Skype for Business Online, Windows PowerShell Module.
  2. Click the Start Button and Search for Windows Power Shell.
  3. Do a right click and select “Run as Administrator”
  4. Run this command set-ExecutionPolicy unrestricted
  5. Then type this cmdlet $credential= Get-Credential
  6. A Windows PowerShell Credential box would pop up. Type in your credentials.
  7. Then run $session= New-CsOnlineSession -Credential $credential
  8. Import-PSSession $session
  9. Then run Get-Module. If you see a table with 3 columns- ModuleType, Name and Exported Commands then the Skype for Business cmdlets are ready for use.Screenshot (116).png
  10. After achieving the objectives, one would have to close the Power Shell session. In order to do that, run this cmdlet Remove-PSSession $session . One must note that simply closing the Power Shell window would not terminate the Power Shell Session.


This Cmdlet for Skype for Business allows you to Enable or Disable a Specific Public Provider. A public provider is an organization that provides SIP Communication services for the General public. So if the Organization enables communication with a Provider “Yahoo”, then the Organization can communicate with any Public User who has a Yahoo Account.


Set-CsTenantPublicProvider has two parameters, “Tenant” and “Provider”. Tenant is where you specify the Tenant ID and Provider is the Public Provider which you want to enable

Set-CsTenantPublicProvider -Tenant “” -Provider

For Example

Set-CsTenantPublicProvider -Tenant “123” -Provider “WindowsLive”

This would Enable the Public IM Provider WindowsLive for the Organization Tenant “123”.

Set-CsTenantPublicProvider -Tenant “123” -Provider “”

Since the Provider attribute is empty, all the public IM Providers would be disabled for the Tenant with ID 123.

Connecting to SharePoint Online using PowerShell

PowerShell allows one to perform bulk operations in a short period of time. It is much faster than doing the same operations over a GUI. In SharePoint Online if one needs to manage Site Collections, they would need to log into the SharePoint Online Admin Center. If one has to use Power Shell in SharePoint Online, they would need to download the SharePoint Online Management Shell. Here are the steps on how to connect to SharePoint Online and perform operations using Power Shell.



  1. Download the SharePoint Online Management ShellScreenshot (112).png
  2. On the Start Menu, type sharepoint.
  3. Click on the App, SharePoint Online Management Shell
  4. Then enter the following commands.
$adminUPN="<the full email address of a SharePoint Online global administrator
 account, example:>"
$orgName="<name of your Office 365 organization, example: contosotoycompany>"
$userCredential = Get-Credential -UserName $adminUPN -Message "Type the password."
Connect-SPOService -Url https://$ -Credential