4 Dec 2019 by Mike Weaver
Inspire: Winning Hearts and Minds
Successful change management requires inspirational leadership. Here’s how to keep your team on track.
This blog post will help you create a desktop shortcut to automatically connect you to Office 365 using PowerShell. We promise that this will help you save time and minimize frustration caused by mis-typed PowerShell commands.
Firstly, copy & paste in the following two commands into your favourite text editor (Such as Notepad)
$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://ps.outlook.com/powershell/" -Credential $cred -Authentication Basic -AllowRedirection
Save the file as Connect-PS.ps1 in a folder such as c:\MyScripts\
Make sure the file extension is ps1 otherwise it won’t be recognized as a PowerShell script.
Now, create a new shortcut on your desktop.
When you specify the file location for your new shortcut you will need to include 3 elements.
powershell.exe -noexit & “C:\My Scripts\Connect-PS.ps1”
Once you have saved your new shortcut to your desktop, double-click and away you go.
If you get an error when attempting to run the PowerShell script, check out this blog post about allowing PowerShell scripts to execute.