Queuing a build in PowerShell
I just read Aaron's post "Team Build Object Model - Queueing a Build" and I just had convert his code to PowerShell (for those of us that just hate waiting for code to compile!).
So, here is how to Queue a build in PowerShell (uses my Get-BuildServer script found here):
> $buildserver = Get-BuildServer "https://tfs:8080"
> $teamProject = "TeamProject"
> $buildDefinition = "Nightly"
> $definition = $buildserver.GetBuildDefinition($teamProject, $buildDefinition)
> $request = $definition.CreateBuildRequest()
> $buildserver.QueueBuild($request, "None")
As you can see the code is almost identical (minus the great comments that Aaron's code has). The benefit that I see to doing this in PowerShell is simply that you don't have to open VS, create a new project, write the code, compile it, open the bin folder, and then run the exe. Instead, you can simply open PS, type the code, and see the results.
Look for more PowerShell scripts coming soon like Queue-Build.ps1!