Forum Discussion
Can't import SharePoint online Powershell module
To resolve the issue,
(1) Navigate to C:\Windows\Microsoft.NET\assembly\GAC_MSIL
(2) Remove the Microsoft.SharePoint.* assemblies
(3) Uninstall the module with Uninstall-Module -Name Microsoft.Online.SharePoint.PowerShell
After reinstalling the module from the PowerShell gallery, the module worked flawlessly.
Glenn Goffin I don't think direct manipulation of dlls in the GAC is the right solution here. This issue is actually caused by a conflict with SharePoint Online Components SDK. Recent versions of the Microsoft.Online.SharePoint.PowerShell module simply will not load as long as that is installed on a system. If you uninstall SharePoint Online Components, the module will load just fine.
- DeTronAug 13, 2020Copper Contributor
Kirk Munro although I strongly agree with your cautious approach to this, I wanted to note that my various attempts to uninstall the SharePoint Online Components (e.g. initial uninstall = no luck. re-install and uninstall using elevated command prompt = no luck) never did the trick. Using Glenn Goffin 's GAC "nuclear option" was what finally did the trick for me.
I assume the SOC components came in from my Visual Studio 2019 install since I don't know how else they got installed, btw. But for now, adios SOC/COSM dlls.
So, Kirk, your warnings may be especially important for those (unlike me) who are doing ShPt dev work.
Respectfully, D.