I'm looking for a way to set the retain indefinitely field of a build when it completes.
Maybe using a PowerShell script as a build step?
Check out the "Build Updating Tasks" extension. It contains a Build Retention task. It does exactly what you need. You do need to be on Update 3 of TFS if I'm not mistaking.