Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

QueryBuilds Performance Question

$
0
0

Hello,

My PS Script works fine, but the performance for one query is not so good, becuase there are a lot of build in the project collection.

My script is this one:

cls
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.Client")  
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.Build.Client")  
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.Build.Common") 
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.WorkItemTracking.Client") 
$tfsCollectionUrl = "http://ztfs:8080/tfs/prod_mes"
$teamProjectCollection = [Microsoft.TeamFoundation.Client.TfsTeamProjectCollectionFactory]::GetTeamProjectCollection($tfsCollectionUrl)
Write-Host "Team Project Collection: "$teamProjectCollection
$ws = $teamProjectCollection.GetService([type]"Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore")
write-host "WorkItemStore: "$ws
$WorkItem = $ws.GetWorkItem(5856)
$WorkItem.Attachments.Count
Write-Host $WorkItem.Title
Write-Host $WorkItem.Attachments.Count
$buildServer = $teamProjectCollection.GetService([Microsoft.TeamFoundation.Build.Client.IBuildServer])
# write-host "Build Server: "$buildServer
Write-Host $buildServer
$buildDetail = $buildServer.QueryBuilds("MES","MES.Release") |  `
	where { $_.BuildNumber -eq "MES.Release_20130819.11301" }#  | select Buildnumber, Droplocation,KeepForever
Write-Host "Buildnumber: "$buildDetail.BuildNumber
Write-Host "Drop Location: "$buildDetail.DropLocation
Write-Host "Retain Indefinitely: "$buildDetail.KeepForever

If I use for $buildDetail this it takes 3 minutes to get the information:

$buildDetail = $buildServer.QueryBuilds("MES") |  `
where { $_.BuildNumber -eq "MES.Release_20130819.11301" }

If I use for $buildDetail this it takes 1 minutes to get the information, the different is, the paramter Build Definition is also in the query builds !

$buildDetail = $buildServer.QueryBuilds("MES","MES.Release") |  `
where { $_.BuildNumber -eq "MES.Release_20130819.11301" }

Is there also another option to get a better performance at this query?

I hope somebody can help me,

Thanks Horst MOSS 2007 Farm; MOSS 2010 Farm; TFS 2010; IIS 7.5


Viewing all articles
Browse latest Browse all 21975

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>