none
ADD-computer with -newname and joinwithnewname option RRS feed

  • 質問

  • Hi,

    I've been looking for a way to add a server to a domain after renaming it (without reboot in between). All the existing threads I've found were not solved, at least not with the powershell command add-computer. 

    The answer in Powershell according the Microsoft technet:

     Add-Computer -ComputerName Server01 -Domain Domain02 -NewName Server044 -Credential Domain02\Admin01 -Restart

    When trying this, I get the message that "The directory service is busy"

    I've also tried with the rename-computer upfront (without reboot), I've also tried with adding the option "JoinWithNewName.
    - If I first rename, I get "The specified network name is no longer available"
    - When using the -option JoinWithNewName, I get "No mapping between account names and security IDs was done".

    I'm logged on with a local administrator and give domain admin credentials to the add-computer command.

    I was not able to find a way to get it working

    Regards,

    WiM

    2014年1月28日 16:15

回答

  • finally got it working... with only one reboot...

    First I used the Rename-computer cmdlet followed by the add-computer cmdlet with joinwithnewname option specified. I got the an error "the network name does not exist..." After some testing I found that when you add a sleep between the rename-computer and add-computer, you don't get that error...

    So finally:

    Rename-Computer -NewName $servername
    sleep 5
    add-computer -DomainName $domainname -Credential $Credential -OUPath $OU -force -Options JoinWithNewName,AccountCreate -restart

    ....did the trick

    Regards,

    WiM

    2014年1月28日 23:58

すべての返信

  • Have you tried to precreate the computer account in AD first before attempting to join to Domain ?

    Regards Sivakarthi

    2014年1月28日 18:43
  • No, I didn't. Should I do this?

    Regards,

    WiM

    2014年1月28日 19:43
  • finally got it working... with only one reboot...

    First I used the Rename-computer cmdlet followed by the add-computer cmdlet with joinwithnewname option specified. I got the an error "the network name does not exist..." After some testing I found that when you add a sleep between the rename-computer and add-computer, you don't get that error...

    So finally:

    Rename-Computer -NewName $servername
    sleep 5
    add-computer -DomainName $domainname -Credential $Credential -OUPath $OU -force -Options JoinWithNewName,AccountCreate -restart

    ....did the trick

    Regards,

    WiM

    2014年1月28日 23:58