Powershell: How to connect to Office 365 with Powershell
You can simply manage and administrate Office 365 from your Powershell prompt or with your own Powershell scripts.
Here is how you can connect to Office 365 with Windows PowerShell:
First create a object with your Windows Live Credentials. This command will open a Windows in which you can enter your Windows Live Credentials for your Office365 Accout. In my case [email protected] and my password.
$LiveCred = Get-Credential
You can open a new Session:
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
Now join the session with:
To close the Session:
Now if you join the PS session with Enter-PSSession you can now work online and run commands like Get-User. More about working with Powershell and Office 365 in the next posts.