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
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
Rename-Computer -NewName "NewComputerName" -Restart