我们正在尝试使用Powershell在TFS中获取特定分支的变更集列表。
工具:PowerShell ISE,TFS Server 2012,Windows 2008 R2服务器SP1
对于我们在服务器上的旧Windows帐户-服务器路径和本地路径代码选项都可以使用。
对于具有新Windows帐户的用户-本地路径无效,但服务器路径有效。
我们是否缺少某处的权限?哪一种?
# Enforce coding rules
Set-StrictMode -version 2.0
# Loads Windows PowerShell snap-in if not already loaded
if (
(Get-PSSnapin -Name Microsoft.TeamFoundation.PowerShell
-ErrorAction SilentlyContinue) -eq $null
)
{
Add-PSSnapin Microsoft.TeamFoundation.PowerShell -ErrorAction SilentlyContinue
}
$dateRange = "D" + "2020-02-13T15:02:49" + "~D" + "2020-02-20T13:37:47"
Write-Host "---OPTION 1 (works) using a server path ---"
$TfsServer = "http://**tfs01:8080/tfs/*****"
[Microsoft.TeamFoundation.Client.TfsTeamProjectCollection] $tfs = get-tfsserver $TfsServer
$results = Get-TfsItemHistory $/SolutionName/Main -Server $tfs
-Recurse
-Version $dateRange
| Sort CreationDate
| Select ChangeSetId,OwnerDisplayName,Comment,CreationDate
| Select-Object ChangeSetId,CreationDate,OwnerDisplayName,Comment
foreach ($line in $results)
{
if (![string]::IsNullOrEmpty($line))
{
Write-Host $line
}
}
Write-Host "---OPTION 2 (doesn't work) using a local path ---"
$locationToSearch = "D:\TFS01\LP\SolutionName\Main\Project"
$results = Get-TfsItemHistory $locationToSearch
-Recurse
-Version $dateRange
| Sort CreationDate
| Select ChangeSetId,OwnerDisplayName,Comment,CreationDate
| Select-Object ChangeSetId,CreationDate,OwnerDisplayName,Comment
foreach ($line in $results)
{
if (![string]::IsNullOrEmpty($line))
{
Write-Host $line
}
}
期望使用服务器路径来获取变更集。