TFS 2013 Power Toolsで提供されるPowerShellコマンドレットをTeam Servicesアカウントに対して実行することはできません。問題のあるコマンドには、Get-TfsItemHistory
とGet-TfsChangeset
が含まれます。これらは、TFSのホストされていないインスタンスでは正常に動作しますが、Team Servicesでは動作しません。 tf.exe
とtfpt.exe
を使用してTeam Servicesに正常に接続できます。 スクリプトがスローされた例外とともに以下に示されています。 これらのコマンドをTeam Servicesで使用することはできますか?もしそうなら、私は間違っていますか?おかげさまで Microsoft.TeamFoundation.PowerTools.PowerShellコマンドレットを使用してVisual Studio Team Services(VSO)をクエリする方法
#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
何か問題が見えても、変更セットは正常に取得できます。 "Get-TfsChangeset"を実行したときに指定したエラーが発生しました。$ tfsCollection.Authenticate()中にエラーが発生しましたか?あなたが参照するためにチェンジセットを取得するために私が前に使用したPowerShellスクリプトも追加しました。 –