This is a simple script I wrote for programatically setting the OSDComputer name during a deployment (MDT or SCCM). It first collects several values (Make, Model, Serial, Name) then follows pre-set rules for naming conventions. If a valid name cannot be determined, it prompts a Dialog box to collect the name during imaging. This can easily be adapted to any rules and enhanced as needed (say, to check if Desktop or Laptop, Server or Workstation, etc).
If using with MDT, just call the script as an application or put it in Scripts and call directly. Call in the State Capture group.
If using with SCCM, include the script in your MDT Package and call after using the MDT Package in the Initialization group.