Error This Operation is only allowed for the Primary Domain Controller of the domain with Add-Computer



  • When using Add-Computer in PowerShell to join to a domain, I am getting this error:

    This Operation is only allowed for the Primary Domain Controller of the domain

    But I can't see why.

    Add-Computer -DomainName "mydomain"


  • Turns out that it needed the -Credential flag, which Microsoft doesn't document as a requirement. This worked find...

    Add-Computer -DomainName "mydomain" -Credential mydomain\myusername


  • Turns out that it needed the -Credential flag, which Microsoft doesn't document as a requirement. This worked find...

    Add-Computer -DomainName "mydomain" -Credential mydomain\myusername