Forum Discussion
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=3.0.0.0, 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.
- Alex MelchingIron ContributorPowerShell was corrected in a Windows Update.
- Vadivelu_BalusamyIron ContributorAlex 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
https://technet.microsoft.com/en-us/library/hh849970.aspx?f=255&MSPPError=-2147217396
If you are try to connect the Office365 Tenant and use the all modules inside the O365 , refer the below article
https://technet.microsoft.com/en-us/library/dn568015.aspx?f=255&MSPPError=-2147217396
Hope it will give some better idea...- Alex MelchingIron Contributor
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.
- Alex MelchingIron Contributor
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.