How to rename a Windows computer from the command line
To rename a domain joined computer:
netdom renamecomputer PCbuh1 / newname: Host1 / userD: corp \ Administrator Passwordd: **** / usero: corp \ Administrator / passwordo: ***** / reboot
Running this command will rename your computer. In order for the changes to take effect, restart your PC.
The general syntax of the netdom renamecomputer command is:
netdom renamecomputer / newname: / userD: Passwordd: domainpass / usero: / passwordo: localpass / reboot
In the example above, if you enter the asterisk (“*”) character, not the password, then during the execution of the command, it will ask you for the password.
The UserD and PasswordD options allow you to log in to an Active Directory domain controller. The UserO and passwordO parameters allow connections to the local host. Here you can use the same account, as long as it has the necessary rights in the domain to the computer account.