Skip to content

Category: Powershell


Categories:

Powershell: Rename remote computer with WMI

Post date:
Author:

To rename a computer when Rename-Computer is not available (pre Powershell 4.0) Get-WmiObject Win32_ComputerSystem -ComputerName OLDNAME -Authentication 6 | ForEach-Object {$_.Rename(“NEWNAME”,”PASSWORD”,”USERNAME”)}   You can also mask the password $credential = Get-Credential Get-WmiObject Win32_ComputerSystem -ComputerName OLDNAME -Authentication 6 | ForEach-Object {$_.Rename(“NEWNAME”,$credential.GetNetworkCredential().Password,$credential.Username)}