同时使用以下命令为Microsoft.TeamFoundation.PowerShell添加Microsoft.TeamFoundation.PowerShell
Add-PSSnapin 'Microsoft.TeamFoundation.PowerShell'得到这个错误
由于以下错误,无法加载Windows 'Microsoft.TeamFoundation.PowerTools.PowerShell.TFPSSnapIn‘snap-in Microsoft.TeamFoundation.PowerShell :无法将类型为PowerShell的对象强制转换为type'System.Management.Automation.CustomPSSnapIn'.
运行此命令Get-PSSnapin -Registered | fl *,我将为已安装的Get-PSSnapin -Registered | fl *获得适当的结果
Name : Microsoft.TeamFoundation.PowerShell
IsDefault : False
ApplicationBase : C:\Program Files (x86)\Microsoft Team Foundation Server 2015 Power Tools
AssemblyName : Microsoft.TeamFoundation.PowerTools.PowerShell, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
ModuleName : C:\Program Files (x86)\Microsoft Team Foundation Server 2015 Power Tools\Microsoft.TeamFoundation.PowerTools.PowerShell.dll
PSVersion : 5.1
Version : 14.0.0.0
Types : {}
Formats : {}
Description : This is a PowerShell snap-in that includes the Team Foundation Server cmdlets.
Vendor : Microsoft Corporation
LogPipelineExecutionDetails : FalseComputer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\PowerShellSnapIns\Microsoft.TeamFoundation.PowerShell上有一个正确的注册表项。PowerShell 5.1
Major Minor Build Revision
----- ----- ----- --------
5 1 17763 1发布于 2018-10-24 07:21:25
请确保您已经完全安装了TFS Powertools。
默认情况下,它不安装PowerShell CmdLets。如果它是,只要安装它,然后问题就会消失。
另一种可能是,PowerShell插件存储在与操作系统版本(32位/64位)不一致的注册表中。
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\PowerShell\1\PowerShellSnapIns,安装程序是32位的,在64位计算机上,它会写到HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\PowerShellSnapIns.,而不会写到HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\PowerShellSnapIns.。
有关详细信息,请参阅此类似的线程:TFS 2008 Powershell管理单元不会在Windows2008 R2中的64位上运行吗?
https://stackoverflow.com/questions/52962070
复制相似问题