PowerShell 2.0 实践(十三)管理 TFS 2010(3)
来源:互联网 发布:梦幻西游数据账号货源 编辑:程序博客网 时间:2024/06/06 17:39
本次我们继续深入探讨TFS 2010的对象模型,通过PowerShell简洁的进行表达。
测试脚本下载
本系列所有脚本均在Windows Server 2008 R2 DataCenter (PowerShell 2.0) + PowerGUI Script Editor Free Edition x64中测试通过。
TFS 2010系列使用了TFS 2010 Ultimate x64、TFS 2010 Power Tools April 2010。
转载请注明出处:http://www.cnblogs.com/brooks-dotnet/archive/2010/10/12/1849182.html
1、获取TFS 2010中所有的Team Project Collection:
#添加 TFS 2010客户端对象模型程序集
[Reflection.Assembly]::Load("Microsoft.TeamFoundation.Client, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
#注意替换为你本机 TFS 2010的URL
$instanceBaseUrl= "http://brookspcnb:8080/tfs/";
$tfsServer= New-Object Microsoft.TeamFoundation.Client.TfsConfigurationServer $instanceBaseUrl;
#调用 ITeamProjectCollectionService
$tpcSvc= $tfsServer.GetService([Microsoft.TeamFoundation.Framework.Client.ITeamProjectCollectionService]);
foreach($coin $tpcSvc.GetCollections())
{
Write-Host $co.Name
}
运行结果:
可以看到,和GUI中的一致:
脚本中调用了客户端的ITeamProjectCollectionService服务,其实就是个接口,除此之外,TFS 2010还提供了很多其他的服务:(摘自MSDN)
Service
TfsConfigurationServer
(server-level)
TfsTeamProjectCollection
(collection-level)
ITeamFoundationRegistry
IIdentityManagementService
ITeamFoundationJobService
IPropertyService
IEventService
ISecurityService
ILocationService
TswaClientHyperlinkService
ITeamProjectCollectionService
IAdministrationService
ICatalogService
LabFrameworkService
VersionControlServer
WorkItemStore
IBuildServer
ITestManagementService
LabFrameworkService
LabAdminService
LabService
IWorkflowIntegrationService
ITestIntegrationService
ILinking
ICommonStructureService3
IServerStatusService
IProcessTemplates
2、获取一个Team Project Collection中所有的Team Project及其签入日期:
#添加 TFS 2010客户端对象模型程序集
[Reflection.Assembly]::Load("Microsoft.TeamFoundation.Client, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
$url= New-Object -TypeName Uri-ArgumentList "http://brookspcnb:8080/tfs/DefaultCollection"
$project= New-Object -TypeName Microsoft.TeamFoundation.Client.TfsTeamProjectCollection-ArgumentList $url
Get-TfsChildItem-Server $project | Select ServerItem,CheckinDate
运行结果:
GUI结果:
3、获取指定Project Collection的更改集ChangeSet:
#添加 TFS 2010客户端对象模型程序集
[Reflection.Assembly]::Load("Microsoft.TeamFoundation.Client, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
$url= New-Object -TypeName Uri-ArgumentList "http://brookspcnb:8080/tfs/DefaultCollection"
$co= New-Object -TypeName Microsoft.TeamFoundation.Client.TfsTeamProjectCollection-ArgumentList $url
Get-TfsChangeset-Server $co –Latest
运行结果:
小结:
本次测试了基本的命令,如查询Team Project Collection、Team Project、ChangeSet等,可以看到都是要使用TFS 2010对象模型的。下一次我们将使用PowerShell创建Team Project Collection、Team Project等,以及添加更改集、提交挂起的更改等。
- PowerShell 2.0 实践(十三)管理 TFS 2010(3)
- PowerShell 2.0实践(十)管理TFS 2010 (1)
- PowerShell 2.0 实践(十一)管理 TFS 2010 (2)
- PowerShell 2.0 实践(七)管理活动目录(上)
- PowerShell 2.0 实践(八)管理活动目录(中)
- PowerShell 2.0 实践(九)管理活动目录(下)
- PowerShell 2.0 实践(四)管理Windows进程
- PowerShell 2.0 实践(五)管理Windows注册表
- PowerShell 2.0 实践(六)管理Windows日志
- SharePoint 2010 PowerShell(3)使用PowerShell管理列表
- SharePoint 2010 PowerShell(3)使用PowerShell管理列表
- SharePoint 2010 PowerShell(3)使用PowerShell管理列表
- PowerShell 2.0 实践(十二)管理 SQL Server 2008 R2(1)
- PowerShell 2.0 实践(十四)管理 SQL Server 2008 R2(2)
- TFS 2010 使用手册(三)权限管理
- TFS 2010 使用手册(三)权限管理
- PowerShell 2.0 实践(一)操作文件系统
- PowerShell 2.0 实践(一)操作文件系统
- 用Sql添加删除字段,判断字段是否存在的方法
- PowerShell 2.0实践(十)管理TFS 2010 (1)
- PowerShell 2.0 实践(十一)管理 TFS 2010 (2)
- C# DataGridView导出到Excel
- PowerShell 2.0 实践(十二)管理 SQL Server 2008 R2(1)
- PowerShell 2.0 实践(十三)管理 TFS 2010(3)
- 算法的时间复杂度(计算实例)
- PowerShell 2.0 实践(十四)管理 SQL Server 2008 R2(2)
- PowerShell 2.0 实践(十五)添加任务计划并将Excel导入SQL Server
- Java字符串"学java"占多少内存空间
- dev c++使用入门
- JS判断对象是否存在
- hdu 1052 Tian Ji -- The Horse Racing(贪心)
- 山寨QQ问题:class not found