Home

Can't import SharePoint online Powershell module

%3CLINGO-SUB%20id%3D%22lingo-sub-359581%22%20slang%3D%22en-US%22%3ECan't%20import%20SharePoint%20online%20Powershell%20module%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-359581%22%20slang%3D%22en-US%22%3E%3CP%3Ewhen%20I%20use%3CBR%20%2F%3EImport-Module%20Microsoft.Online.SharePoint.PowerShell%3C%2FP%3E%3CP%3Eit%20says%3C%2FP%3E%3CP%3EPS%20C%3A%5CWindows%5Csystem32%26gt%3B%20Import-Module%20Microsoft.Online.SharePoint.PowerShell%3CBR%20%2F%3EImport-Module%20%3A%20Could%20not%20load%20type%20'Microsoft.SharePoint.Administration.DesignPackageType'%20from%20assembly%20'Microsoft.SharePoint.Client%2C%20Version%3D16.0.0.0%2C%20Culture%3Dneutral%2C%3CBR%20%2F%3EPublicKeyToken%3D71e9bce111e9429c'.%3CBR%20%2F%3EAt%20line%3A1%20char%3A1%3CBR%20%2F%3E%2B%20Import-Module%20Microsoft.Online.SharePoint.PowerShell%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20NotSpecified%3A%20(%3A)%20%5BImport-Module%5D%2C%20TypeLoadException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20System.TypeLoadException%2CMicrosoft.PowerShell.Commands.ImportModuleCommand%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20this%20binary%20module%20installed%3A%3C%2FP%3E%3CP%3EDirectory%3A%20C%3A%5CProgram%20Files%5CWindowsPowerShell%5CModules%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EModuleType%20Version%20Name%20ExportedCommands%3CBR%20%2F%3E----------%20-------%20----%20----------------%3CBR%20%2F%3EBinary%2016.0.86...%20Microsoft.Online.SharePoint.Powe...%3CBR%20%2F%3EBinary%2016.0.80...%20Microsoft.Online.SharePoint.Powe...%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20clues%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-359581%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-359630%22%20slang%3D%22en-US%22%3ERe%3A%20Can't%20import%20SharePoint%20online%20Powershell%20module%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-359630%22%20slang%3D%22en-US%22%3ESome%20things%20you%20can%20try%3A%3CBR%20%2F%3E(1)%20Check%20If%20you%20already%20installed%20the%20module%20by%20means%20of%20the%20SharePoint%20Online%20Management%20Shell...if%20so%2C%20uninstall%20it%3CBR%20%2F%3E(2)%20Try%20to%20us%20the%20-force%20parameter%20in%20the%20Import-Module%20cmdlet%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-871594%22%20slang%3D%22en-US%22%3ERe%3A%20Can't%20import%20SharePoint%20online%20Powershell%20module%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-871594%22%20slang%3D%22en-US%22%3EI%20had%20the%20exact%20same%20problem%2C%20mine%20was%20caused%20by%20Microsoft.SharePoint.Client.dll%20installed%20in%20the%20Global%20Assembly%20Cache.%3CBR%20%2F%3E%3CBR%20%2F%3ETo%20resolve%20the%20issue%2C%3CBR%20%2F%3E(1)%20Navigate%20to%20C%3A%5CWindows%5CMicrosoft.NET%5Cassembly%5CGAC_MSIL%3CBR%20%2F%3E(2)%20Remove%20the%20Microsoft.SharePoint.*%20assemblies%3CBR%20%2F%3E(3)%20Uninstall%20the%20module%20with%20Uninstall-Module%20-Name%20Microsoft.Online.SharePoint.PowerShell%3CBR%20%2F%3E%3CBR%20%2F%3EAfter%20reinstalling%20the%20module%20from%20the%20PowerShell%20gallery%2C%20the%20module%20worked%20flawlessly.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E
Andy_Bond
Occasional Contributor

when I use
Import-Module Microsoft.Online.SharePoint.PowerShell

it says

PS C:\Windows\system32> Import-Module Microsoft.Online.SharePoint.PowerShell
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 line:1 char:1
+ Import-Module Microsoft.Online.SharePoint.PowerShell
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Import-Module], TypeLoadException
+ FullyQualifiedErrorId : System.TypeLoadException,Microsoft.PowerShell.Commands.ImportModuleCommand

 

I have this binary module installed:

Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Binary 16.0.86... Microsoft.Online.SharePoint.Powe...
Binary 16.0.80... Microsoft.Online.SharePoint.Powe...

 

Any clues?

2 Replies
Some things you can try:
(1) Check If you already installed the module by means of the SharePoint Online Management Shell...if so, uninstall it
(2) Try to us the -force parameter in the Import-Module cmdlet
Highlighted
I had the exact same problem, mine was caused by Microsoft.SharePoint.Client.dll installed in the Global Assembly Cache.

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.


Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
46 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
30 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies