We recently had the need to force all PXE clients to use a specific task sequence. We wanted to use SMSTSPreferredAdvertID but didn’t want to hard-code the task sequence ID into a prestart script. I can up with a quick and dirty PowerShell prestart script to set SMSTSPreferredAdvertID.
$tsenv = New-Object -ComObject Micro.SMS.TSEnvironment
$launchMode = $tsenv.Value("_SMSTSLaunchMode")
if ($launchMode -eq "PXE")
(New-Object System.Net.WebClient).DownloadFile("http://cm01/PXE/PXETS.txt", "$($ENV:TEMP)\PXETS.txt")
$deploymentId = Get-Content "$ENV:TEMP\PXETS.txt"
$tsenv.Value("SMSTSPreferredAdvertID") = $deploymentId
This requires you to put a .txt file on a web server with anonymous authentication enabled. In our case we created a new web application on the CM site server and enabled anonymous authentication. The contents of this text file is simply the advertisement ID you want PXE to use. Since we are checking _SMSTSMediaType for being set to PXE this will not impact your normal boot media.