Channel: blog.atwork.at
Viewing all articles
Browse latest Browse all 1118

"PowerShell has stopped working" issue when working with Office 365 Remote Exchange PowerShell


We are using a lot of PowerShell for configuring Office 365 tenants and Exchange Online.

When getting new requests, I usually use my existing PS-Scripts to connect to Exchange Online, modify them, execute them and that’s it – that’s the real world scenario.

Recently I had the issue that – when connecting to Exchange Online – I always got the error "PowerShell has stopped working" or when using PS ISE "PowerShell_ise has stopped working".


First I suspected that there was an issue with my Windows 10 Updates on PowerShell…

These tips did not help:

  • Open Run, type PowerShell_Ise -NoProfile or PowerShell -NoProfile and hit Enter. Does it open? If so there maybe issues with the Profile.
  • Run PowerShell as Administrator.
  • Run System File Checker sfc /scannow and see if it helps.
  • FYI, ISE needs .Net 3.5 (repair .net framework).
  • Reinstall the Windows feature "PowerShell".

Then I found out the (simple) reason. See my full connect.ps1 script here.


The parameter -ConnectionUri with the value https://ps.outlook.com/powershell/ and –AllowRedirection caused that issue. That’s the issue and the fix:

# $session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $cred -Authentication Basic –AllowRedirection

$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $cred -Authentication Basic -AllowRedirection

I had in mind that the URI was renewed (some time ago), but simply had forgotten about this.
When using the correct -ConnectionUri value "https://outlook.office365.com/powershell-liveid/" everything works again.

I need to update my PS connection scripts… Zwinkerndes Smiley

Hope this tip helps!

Viewing all articles
Browse latest Browse all 1118

Latest Images

Trending Articles