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.
- jana123295Nov 21, 2022Copper Contributor
- Mirza1443Jun 09, 2022Copper ContributorJust an additional thing I had to do after your solution, whenever I open a new Powershell session, I have to run a command like Connect-SPOSite before running anything related to loading CSOM assemblies, Ctx xlient context, and all that Client Component SDK related stuf. Took me a full day to realise that, a lot of trial and error, trying with different versions, etc
- hespinosx2Jul 23, 2021Copper Contributor
Glenn Goffin you help me too with this steps
Thanks!!!
- Shubhra_MajumdarApr 09, 2021Copper ContributorThis worked for me. Thanks!
- chrispaivacwbDec 29, 2020Copper Contributor
Saved my life here.
Thanks for this great help !!!!! - KaiW76Dec 02, 2020Copper Contributor
Hello everybody,
I had the same problem and was able to fix it with the manual, so my scripts all work fine, thanks for that.
But when I execute the script as a scheduled task I get this message again.PS>TerminatingError(Import-Module): "Could not load type 'Microsoft.SharePoint.Administration.DesignPackageType' from assembly 'Microsoft.SharePoint.Client, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'." Import-Module : Could not load type 'Microsoft.SharePoint.Administration.DesignPackageType' from assembly 'Microsoft.SharePoint.Client, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'. At C:\Users\xxx\Desktop\Skripte\Create-TECTeams.ps1:71 char:1 + Import-Module -Name Microsoft.Online.SharePoint.PowerShell + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Import-Module], TypeLoadException + FullyQualifiedErrorId : System.TypeLoadException,Microsoft.PowerShell.Commands.ImportModuleCommand PS>TerminatingError(Import-Module): "Could not load type 'Microsoft.SharePoint.Administration.DesignPackageType' from assembly 'Microsoft.SharePoint.Client, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'."
I don't know what to do, if someone has an idea... I would be glad about every help.
best regards
Kai - whugs84Oct 06, 2020Copper Contributor
Thank you so much for your post. It has just worked for me after a lot of getting annoyed at powershell!
Glenn Goffin - samartomarAug 20, 2020Copper ContributorThank you worked.
- Kirk MunroApr 22, 2020Copper Contributor
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 https://www.microsoft.com/en-ca/download/details.aspx?id=42038. 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.
- parlevjoppinktestApr 03, 2020Copper Contributor
Glenn Goffin Thanks for your help! It worked for me.
What are those assemblies for in C:\Windows\Microsoft.NET\assembly\GAC_MSIL ?