Ok, I think I understand where the confusion is coming from.
You mentioned 'DNS name' in the thread title, which I took for the set up of the DNS Servers, while you obviously mean the hostname inside the guest OS.
That you can set, in a limited way, with the NamingScheme parameter of the New-OSCustomizationSpec cmdlet.
The GUI screenshot conatins the same options as you can find in the NamingScheme options.
If the hostname can't be realised through the available schemes, you can use the Invoke-VMScript cmdlet to send the command to the guest OS.