Q. How can I join a machine to a domain and rename it using PowerShell?
A. PowerShell version 3 introduces a -NewName parameter for Add-Computer which enables a machine to join and domain and have a new name set with a single command. This removes having to rename the machine using:
The new command would therefore be:
Add-Computer -Credential cred -DomainName savilltech.net -NewName server;Restart-Computer -force
Note I also use Restart-Computer to complete the rename and domain join operation.