Thursday, December 27, 2018

How to Connect Powershell to Office365

1. Install the Microsoft Online Services Sign-In Assistant for IT Professionals RTW MSI application. You cannot perform the next steps without it being installed:

2. Open Powershell and install the Install-Module MSOnline module. (Note: Use the Administrator elevated PS)

3. URL for Powershell commands to Manage User accounts and licenses with Office 365 PowerShell:

4. PS Command to Connect to O365: Connect-MsolService -Credential $credential

5. You will be prompted to log in with your O365 administrator account (you cannot use a regular account).

6. Run commands without headaches if your environment permits it: Set-ExecutionPolicy Unrestricted -Force

PS C:\Windows\system32> $UserCredential = Get-Credential

7. Sign-in to Office 365 with Administrator Account

8. Run this command so that you are connected via PowerShell (no there is no GUI):

PS C:\Windows\system32> $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $UserCredential -Authentication Basic -AllowRedirection

9. Turn off the pain in the neck prompts:

PS C:\Windows\system32> Import-PSSession $Session -DisableNameChecking



Post a Comment