That is the script that I've been using, however, that runs after my front end so the system stays MININT. I use it as a final verification that the system name has been named by the tech. However, I have extra options available to systems within the CM database (backup, USMT, etc), so when a system shows up as unknown, the only option is to image it as a unknown computer.
When using dynamic site media, the OSDComputerName variable will not populate. When using site-based media, it does populate as expected, with the system name from the CM Database.