I'm using TFS to edit a build deinition then queue it. I have everything I need to get the build server and the build itself. I can even queue a build, but I don't know how to specify an option when I do. The builds are Gated, and when I manually queue them, I have to specify "Latest Sources" when I do so, not "Latest Sources with Shelvesets" which seems to be the default.
Here is an example of what I'm clicking when I queue the build manually.
Below is what I have coded so far:
$teamProjectCollection = [Microsoft.TeamFoundation.Client.TfsTeamProjectCollectionFactory]::GetTeamProjectCollection("$serverURI")
$bs = $teamProjectCollection.GetService([type]"Microsoft.TeamFoundation.Build.Client.IBuildServer")
$build = $bs.GetBuildDefinition("$project", "$template")
#Here is where I would do all of the build editing, but it's not important.
$request = $definition.CreateBuildRequest()
$bs.QueueBuild($request, “None”)
This code works, but I don't know how to specify the option of "Latest Sources" over the "Latest Sources with Shelveset". Can anyone help?

$request.ShelvesetNameor not will determine that (link)