对于Team Services帐户,我无法运行TFS 2013 Power Tools随附的任何PowerShell cmdlet。有问题的命令包括Get-TfsItemHistory
和Get-TfsChangeset
。这些工作正常与TFS的非托管实例,但不是团队服务。 我可以使用tf.exe
和tfpt.exe
成功连接到团队服务。 我的脚本如下所示与抛出的异常一起显示。 这些命令是否可以与Team Services一起使用,如果有的话,我做错了什么? 谢谢。如何查询使用Microsoft.TeamFoundation.PowerTools.PowerShell的Visual Studio Team Services(VSO)cmdlet
#my Team Services credentials:
$Username = "[email protected]"
$tfsPath = "https://myname.visualstudio.com/"
$passwordFile=".\ps-password.pwd"
# read passsword from file
# NOTE: password previously stored within file using command:
# read-host -prompt Password -assecurestring |
# convertfrom-securestring |
# out-file ps-password.pwd -ErrorAction Stop
if (!(test-path $passwordFile))
{
throw [System.IO.FileNotFoundException] "$passwordFile"
}
$Password = Get-Content "$passwordFile" | ConvertTo-SecureString
$creds = New-Object -typename System.Management.Automation.PSCredential -ArgumentList $Username,$Password
$tfsServer = New-Object System.Uri("$tfsPath")
$tfsCollection = New-Object Microsoft.TeamFoundation.Client.TfsTeamProjectCollection($tfsServer,$creds)
$tfsCollection.Authenticate()
# $tfsCollection | show-object # NOTE: content of collection looks good when viewed
# PROBLEM COMMANDS:
Get-TfsChangeset -latest -server $tfsCollection
Get-TfsItemHistory "$/" -Server $tfsCollection -Version "D2010-01-01~D2016-08-01" -Recurse -IncludeItem
错误产生:
Get-TfsChangeset : The filename, directory name, or volume label syntax is incorrect.
At ~\myScript.ps1:30 char:1
+ Get-TfsChangeset -latest -server $tfsCollection
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-TfsChangeset], IOException
+ FullyQualifiedErrorId : System.IO.IOException,Microsoft.TeamFoundation.PowerTools.PowerShell.GetTfsChangesetCommand
我只是你的代码试图在我与VSTS/VSO账户的一面,但没”没有看到任何问题,变更集可以成功获得。您提供的错误发生在“Get-TfsChangeset”时,是否在$ tfsCollection.Authenticate()期间发生任何错误?我还添加了我之前使用的powershell脚本来获取变更集供您参考。 –