I am unable to run any of the PowerShell cmdlets provided with TFS 2013 Power Tools against a Team Services account. Problematic commands include Get-TfsItemHistory
and Get-TfsChangeset
. These work fine with non-hosted instances of TFS but not Team Services.
I can successfully connect to Team Services using tf.exe
and tfpt.exe
.
My script is shown below together with the exception that is thrown.
Can these commands be used with Team Services and if so what am I doing wrong?
Thanks.
#my Team Services credentials:
$Username = "myname@live.com"
$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
Error generated:
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