PowerShell to Office 365 Broken?


When connecting to an Office 365 tenant via PowerShell and running the usual commands to connect, cannot import the session.


PS C:\Users\Alex> Import-PSSession $Session
Import-PSSession : Could not load type 'System.Management.Automation.SecuritySupport' from assembly
'System.Management.Automation, Version=, Culture=neutral, PublicKeyToken="removed"'.
At line:1 char:1
+ Import-PSSession $Session
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Import-PSSession], TypeLoadException
+ FullyQualifiedErrorId : System.TypeLoadException,Microsoft.PowerShell.Commands.ImportPSSessionCommand


I have tried connecting to multiple Office 365 tenants.  I removed the token number.

6 Replies
Alex Melching : You are try to connect the $session ? where it the declaration of the $session. Recommend to check the blow article for more info about the Import-PSSession


If you are try to connect the Office365 Tenant and use the all modules inside the O365 , refer the below article


Hope it will give some better idea...

Yes, I only copied the error message from the PS window.  I have been using PowerShell for quite some time and just today started experiencing this issue.  I have now seen the same error start to pop up on other forums.

Side note:  My Windows 10 did get updated to 14393.82.  So I now have PowerShell version 5.1.14393.82.  Will check an older machine.

Confirmed.  Previous version of PowerShell 5.1.14393.0 connects fine to Office 365.  Something wrong in with new version.

Alex Melching  Dependency assembly were missing after upgrade in WIN10 system. Just in reinstall the Powershell 5.* in your system.
So that all misssing assmebly will placed in the GAL.
PowerShell was corrected in a Windows Update.