Forum Discussion
Andy_Bond
Mar 03, 2019Copper Contributor
Can't import SharePoint online Powershell module
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...
Glenn Goffin
Brass Contributor
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.
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.
KaiW76
Dec 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