If I am understanding you correctly, if I want to run a customization script that rename the computer from inside then I have to do it when I deploy the VM and not after it,
meaning :
New-vm -vmhost xxx.xxx.xx.xx -Name VMName | -Template TemplateName -OSCustomizationSpec SpecName |
and not
New-vm -vmhost xxx.xxx.xx.xx -Name VMName | -Template TemplateName |
Set-vm -VM VMName -OSCustomizationSpec SpecName |
am I right?