0
votes

I am trying to connect and get change sets from my TFS. For that I used this command:

powershell -Command "get-pssnapin -Registered

I got result like

Name        : Microsoft.TeamFoundation.PowerShell
PSVersion   : 2.0
Description : This is a PowerShell snap-in that includes the Team Foundation Server cmdlets.

Name        : WDeploySnapin3.0
PSVersion   : 2.0
Description : This is a PowerShell snap-in that contains cmdlets for managing Microsoft Web Deployment infrastructure.

But when I used this command:

Add-PSSnapin Microsoft.TeamFoundation.PowerShell

I am getting this result:

Add-PSSnapin : Cannot load Windows PowerShell snap-in Microsoft.TeamFoundation.
PowerShell because of the following error: Could not load file or assembly
'Microsoft.TeamFoundation.PowerTools.PowerShell.dll' or one of its
dependencies. The system cannot find the file specified.
At line:1 char:1
+ Add-PSSnapin Microsoft.TeamFoundation.PowerShell
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (Microsoft.TeamFoundation.PowerShell:String) [Add-PSSnapin], PSSnapInException
    + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand 
1
Which version of TFS and VS are you using? - Cece Dong - MSFT
C:\Program Files (x86)\Microsoft Team Foundation Server 2015 Power Tools This version is there in my system . VS 2017 - Prathap

1 Answers

1
votes

Microsoft.TeamFoundation.PowerShell snap-in is from TFS powertools. It seems you have an old version of powertools installed on your machine. I've tested with TFS 2015 powertools on my 64-bit Win10, and got a successful response.

enter image description here

You could check your powertools version and check case TFS Build: `Microsoft.TeamFoundation.PowerShell' is not installed on this computer to see whether the solution helps you.

By the way, you could use .NET client libraries for VSTS (and TFS) instead of powertools snap-in.