Just a quick note on renaming Windows based machine using CLI (this may be especially useful when working with Server Core).
Before renaming machine you may want to see its current name which can be achieved in three different ways:
1) ipconfig /all
2) set
3) hostame
As you can see third option is best one as it gives you specifically machine name without need to search through loads of other details.
Now how to rename. You can use either NETDOM command or Rename-Computer cmdlet:
1) netdom (more details here):
netdom renamecomputer %computername% /newname:NewName /userd:domain\username /passwordd:P@ssw0rd /reboot:0
2) Rename-Computer:
Rename-Computer -NewName "NewComputerName" -Restart