QuickTip – PowerShell – Scripts to Remotely Rename an Active Directory Computer Object

QuickTip – PowerShell – Scripts to Remotely Rename an Active Directory Computer Object

If you are deploying new systems or otherwise need to rename an AD computer object, you can use this script to make the change-

Rename-Computer -ComputerName CURRENNTName -NewName NEWName –DomainCredential ADDomain\admin

Make the changes, inline, to modify the current and new name parameters. As well as, change the “ADDomain\admin” to the AD domain and account that has the necessary permissions to change the name of the computer object.

If you would like to make the script more interactive, you can use prompts to allow you to specify the current and new names of the computer to be renamed, as well as, ask for the credentials of the user with permissions to make the name change.

$CurrentComputerName = Read-Host -Prompt "Current Computer Name"
$NewComputerName = Read-Host -Prompt "New Computer Name"
$Credential = Get-Credential

Rename-Computer -ComputerName $CurrentComputerName -NewName $NewComputerName –DomainCredential $Credential

After supplying the necessary information, you should see it return:

WARNING: The changes will take effect after you restart the computer NewName.

Leave a Reply