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
$mediaType = $tsenv.Value("_SMSTSMediaType")
if ($mediaType -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…