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.
- 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 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.
- Emma BaileyDec 24, 2019Iron Contributor
I just found this thread because I was having the same problem - thank you for these instructions Glenn Goffin, they did the trick for me!
- Martijn MolegraafJan 13, 2020Copper Contributor
Thx Glenn Goffin , this one worked for me !
- Allison BatesFeb 17, 2020Brass Contributor
I have very same error/issue trying to load on a SharePoint 2019 server. I don't think it would be a good idea to delete all the Microsoft.SharePoint assemblies from this server. Any ideas if it will corrupt the SharePoint installation?
- ValerianHMay 12, 2020Copper Contributor
would be also very interesting for me whether "clearing" the GAC destroys SharePoint Server installation.
- Sara Jardim BarbosaMar 31, 2020Copper ContributorThanks for your help! It worked for me.
- 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 ? - samartomarAug 20, 2020Copper ContributorThank you worked.
- 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 - 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 - chrispaivacwbDec 29, 2020Copper Contributor
Saved my life here.
Thanks for this great help !!!!!