I came across the following TechNet post recently which is useful for deploying Hyper-V machines and automating machine renaming to be in-line with the names given to you Hyper-V guests:https://gallery.technet.microsoft.com/scriptcenter/Automate-Virtual-Machine-6c17929c
However, I ran into issues when testing on a Windows 2012 R2 Hyper-V Server and Windows 2012 R2 guest, so modified the rename component as follows – ensure you run from within the guest Operating System:
$virtualmachinename= (Get-ItemProperty 'HKLM:\software\microsoft\virtual machine\guest\parameters').virtualmachinename Rename-Computer -NewName $virtualmachinename.ToUpper() Restart-Computer