locked
Powershell change hostname in a joined domain RRS feed

  • Question

  • Hi, I use the powershell to change a machine name, I use $name as variable to input a name and the follow cmd-let: $computerName.Rename($name) but it only work in a unjoined domain machine.

    my script is the following:

    $computerName = Get-WmiObject Win32_ComputerSystem
    [System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') | Out-Null
    $name = [Microsoft.VisualBasic.Interaction]::InputBox("Enter Desired Computer Name ")
    $computername.rename("$name")

    but I need to change the hostname of any computer joined in my domain, may be it's another command, I don't know and I can't find information seeking the web.

    If somebody knows something I'll be pleasure to know it.

    Thursday, January 16, 2014 12:49 PM

Answers

All replies