Answered rename and reboot machine

  • Wednesday, February 29, 2012 6:34 AM
     
     

    this is not quite working....

    function renameAndReboot([string]$computer, [string]$newname)
    {
    $comp = gwmi win32_computersystem -computer $computer
    $os   = gwmi win32_operatingsystem -computer $computer
    $comp.Rename($newname)
    $os.Reboot()
    }

    renameAndReboot oldmachine newmachine

    I keep getting a return value of 5 and cannot get the machine renamed

All Replies