Office 365 Connection Script - Basic

This PowerShell connection script is perfect for Exchange and user administration as it quickly connects to the following Office 365 Services. - Exchange Online - Azure AD v1.0 - (MSOL) - Azure AD v2.0 - (Azure AD)

 
 
 
 
 
4.7 Star
(3)
5,842 times
Add to favorites
Office 365
6/4/2018
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • Updated to include S4B
    1 Posts | Last post March 15, 2019
    • Thanks for the great script. I use this multiple times a day. I've appended to include Skype for Business management. Not sure if I should post it here or upload my own contribution. I'm adding as notes here since you should get the credit since I'm just editing your work.
      
      Edits:
      edit line 2: $Info = "Where do you want to sign in to? Office 365 Tenant, Skype for Business, or Azure AD Tenant?"
      edit line 5: [int]$defaultchoice = 3
      
      edit insert after line 27:
      2 { #Office365 Powershell Login
          Import-Module SkypeOnlineConnector
          $UserCredential = Get-Credential
          $Session = New-CsOnlineSession -Credential $cred 
          Import-PSSession $Session –AllowClobber
          Connect-MsolService -Credential $UserCredential
          }
      
      edit last group number from 2 to 3: 3 { #Disconnects from all   
      
      
      Other:
      1. Download the Skype for Business module first: https://www.microsoft.com/en-us/download/details.aspx?id=39366
      2. I noticed on my computer that I had to move the whole folder "SkypeOnlineConnector" from the install location "C:\Program Files\Common Files\Skype for Business Online\Modules" to the location where my computer is looking for modules "C:\Program Files\WindowsPowerShell\Modules".
  • Should the powershell window close?
    1 Posts | Last post November 27, 2018
    • Hello Terry,
      
      I'm new to scripting, so take this question with a grain of salt...
      
      I was hoping the PowerShell window would remain open so I could enter PowerShell commands for Exchange online.  Is this not the case?  When I run the script, the window closes immediately following completion.
      
      Thanks,
      Barry