Reputation: 205
I want to rename the computer with PowerShell 2.0 in Windows 7 Sp1, but it got an error.
PS C:\Windows\system32> Rename-Computer -NewName PC02
The term 'Rename-Computer' is not recognized as the name of a cmdlet, function, script f
ile, or operable program. Check the spelling of the name, or if a path was included, ver
ify that the path is correct and try again.
At line:1 char:16
+ Rename-Computer <<<< -NewName PC02
+ CategoryInfo : ObjectNotFound: (Rename-Computer:String) [], CommandNotFo
undException
+ FullyQualifiedErrorId : CommandNotFoundException
Upvotes: 2
Views: 11346
Reputation: 12323
To do this in PowerShell 2.0, use WMI:
(Get-WmiObject Win32_ComputerSystem).Rename('PC02')
You can rename a remote computer by adding -ComputerName CURRENTNAME
after Get-WmiObject.
You must do this from an elevated prompt. This will, of course, require a reboot to take effect.
Upvotes: 2