Thursday, February 15, 2018

Rename Domain Computer using Powershell Script

As name suggests, powershell is very powerful way to automate pretty much all the things in windows.

If you want to rename your computer using power shell script where your computer is part of domain. Here is the the simple set of commands to do it :

1. $user = 'DOMAIN-NAME\USER-NAME'
2. $password = 'PASSWORD'|ConvertTo-SecureString -AsPlainText -force
3. $cred = New-Object System.Management.Automation.PSCredential $user,$password
4. Rename-Computer -ComputerName CURRENT-COMPUTER-NAME -NewName NEW_COMPUTER-NAME -domaincredential $cred

After that you need to restart the computer for changes to take effect.

Hope it helps !!