We Rub Chan
We Rub Chan

Reputation: 205

The term 'Rename-Computer' is not recognized as the name of a cmdlet

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

Answers (2)

Adi Inbar
Adi Inbar

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

Kohlbrr
Kohlbrr

Reputation: 4069

That's because Rename-Computer was introduced in Powershell 3.0

Upvotes: 5

Related Questions