无法加载Add-PSSnapin。发生类型不匹配

时间:2016-02-09 20:41:58

标签: sharepoint sharepoint-2010

我只是尝试运行SharePoint 2010 Management Shell,但它会引发错误。

Add-PSSnapin : Could not load type 'Microsoft.SharePoint.Administration.SPActionLinkType' 

from assembly 'Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, 

PublicKeyToken=71e9bce111e9429c' due to value type mismatch.At 

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration\SharePoint.ps1:3 

char:13+ Add-PsSnapin <<<<  Microsoft.SharePoint.PowerShell    + CategoryInfo  

        : NotSpecified: (:) [Add-PSSnapin], TypeLoadExcept   ion 

   + FullyQualifiedErrorId : System.TypeLoadException,Microsoft.PowerShell.Co   mmands.AddPSSnapinCommand

除了在机器中安装Visual Studio 2015企业外,我不知道可能导致类型不匹配的原因。

任何人都知道为什么?

1 个答案:

答案 0 :(得分:0)

假设您正在讨论从正常的PowerShell命令行Add-PSSnapin加载SharePoint Commandline并将Microsoft.SharePoint.PowerShell作为参数....

最可能的原因是你在x86 powershell下运行的一些方式,这使得x64 .dll不兼容。

您可以尝试检查$ pshost以查看该路径是针对x86还是x64版本的PowerShell:

  

$ pshome#如果你看到x64:

C:\Windows\System32\WindowsPowerShell\v1.0

> $pshome  #if x86 host only you will see:

C:\Windows\SysWOW64\WindowsPowerShell\v1.0
相关问题