是否可以使用 Power Tools 在 PowerShell 中创建新的 TFS 工作区?

Is it possible to create a new TFS workspace in PowerShell with Power Tools?

我正在 PowerShell 中构建一个函数,它创建一个新的工作区并获取指定目录的最新版本,以及其他一些与 TFS 和文件系统相关的任务。现在我混合使用 PowerTools 和 TFS 程序集来完成工作。看起来我可以使用 Power Tools 做几乎所有事情,除了创建一个新的工作区。如果不显式加载 Team Foundation 程序集,我还不知道如何执行此操作。这甚至可能吗?如果可能的话如何?

这是我现在正在做的事情

#Install required TFS assemblies
"Microsoft.TeamFoundation.Client",
"Microsoft.TeamFoundation.VersionControl.Common",
"Microsoft.TeamFoundation.VersionControl.Client" |
    ForEach-Object { Add-Type -AssemblyName "$_, Version=11.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a" }

#Install TFS PowerTools snappin for basic tasks
If ( (Get-PSSnapin -Name Microsoft.TeamFoundation.PowerShell -ErrorAction SilentlyContinue) -eq $null )
{
    Add-PSSnapin Microsoft.TeamFoundation.PowerShell
}

## Set applicable parameters

#Get the TFS server object
$tfs=Get-TfsServer -Name $tfsName

#Get the version control service object
#This is what I want to do with PowerTools - like a new-item or something
$vcs = $tfs.GetService([type]"Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer")

#Create a Workspace parameters object
$workspaceParameters = New-Object Microsoft.TeamFoundation.VersionControl.Client.CreateWorkspaceParameters -ArgumentList $wsName

#Create the Workspace
$tfsw = $vcs.CreateWorkspace($workspaceParameters)

# Add any working folders that you would defined below
$tfsw.Map($tfsLocation, $localFolder)

TFPT 管理单元中仅有的 new 命令是 New-TfsChangesetNew-TfsShelveset。您不能使用 tf.exe workspace /new ...tf.exe workfold ... 有什么原因吗?