Powershell脚本未验证TFS连接

时间:2018-05-22 14:06:46

标签: powershell tfs

我遇到PowerShell连接到VTFS(云基)的问题。我的脚本已经工作多年了。不确定发生了什么,除了我从微软运行的更新,我认为是问题。在Microsoft更新之前,此脚本在四月份运行时没有问题。

I get the following error trying to connect, which generally makes a popup appear for my credentials to Online  Visual Studios.

 if ( (Get-PSSnapin -Name Microsoft.TeamFoundation.PowerShell) -eq $null )
    {
        Add-PSSnapin Microsoft.TeamFoundation.PowerShell
    }

 # Variables - CHECK EACH TIME
    [string] $tfsServerLocationPath = "https://name.visualstudio.com/DefaultCollection"
    [string] $ProjectLocationToSearch = "$/Project/blabla/"
    [string] $outputFile = "c:\temp\RetrievedFiles.txt"
    [string] $dateRange = "D2018-04-18 00:00:00Z~"
    [bool]   $openOutputFile = $true 
    $AutoDeployDir = "$/Project/blabla/"
    $deployDirectory = "C:\Temp\ReleaseTest\DeployFiles\" 
    $tfsCollection = New-Object -TypeName  Microsoft.TeamFoundation.Client.TfsTeamProjectCollection -ArgumentList $tfsServerLocationPath
    $tfsVersionControl = $tfsCollection.GetService([Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer])


**AFTER THIS LINE IS WHEN THE ERROR APPEARS.**
    [Microsoft.TeamFoundation.Client.TfsTeamProjectCollection] $tfs = get-tfsserver  $tfsServerLocationPath 


    get-tfsserver : Key not valid for use in specified state.
At line:31 char:67
+ [Microsoft.TeamFoundation.Client.TfsTeamProjectCollection] $tfs = get-tfsserver  ...
+                                                                   ~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-TfsServer], CryptographicException
    + FullyQualifiedErrorId : GetTfsServer,Microsoft.TeamFoundation.PowerTools.PowerShell.GetTf 
   sServerCommand

Thank You in Advance.

1 个答案:

答案 0 :(得分:0)

哇 - 我的幸运日,对于所有与我有同样问题的人。这是修复。我不得不删除此注册表项。 HKEY_CURRENT_USER \软件\微软\ VSCommon \ 12.0 \ ClientServices \ TokenStorage。

我在下面的帖子中找到了。

http://blogs.msdn.microsoft.com/dstfs/2014/01/10/