Renaming a Computer using PowerShell

Here is a short PowerShell snippet for renaming a domain joined computer using PowerShell. It can be run both locally, and remote.

# Sample script to rename a domain joined computer
$OldComputerName = "CHI1-W10VM-002"
$NewComputerName = "R824-002"

$Username = 'VIAMONSTRA\Administrator'
$Password = '[email protected]'
$pass = ConvertTo-SecureString -AsPlainText $Password -Force
$Cred = New-Object System.Management.Automation.PSCredential -ArgumentList $Username,$pass

Rename-Computer -ComputerName $OldComputerName -NewName $NewComputerName -DomainCredential $Cred -Restart -Force

About the author

Johan Arwidmark

0 0 votes
Article Rating
Subscribe
Notify of
guest
2 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
rosin
rosin
1 month ago

Does it also change the fullname?
What if you also want to change the full name?


>