title: PowerShell Add-Computer giving Access Denied
body: <p>I have a lab environment using Server 2016 and Windows 10 VMs. On the windows 10 machine, I’m using the <code>Add-Computer</code> command to join a domain (windurst.net) using the domain administrator account but get access denied. The command I have in PowerShell is </p>
  
  <pre><code>Add-Computer -DomainName "windurst.net" -OUPath "OU=Test,OU=Workstations,OU=Windurst,DC=Windurst,DC=Net"
  </code></pre>
  
  <p>I can join the domain manually with no issues with the domain administrator account, but it does not work if I’m using the PowerShell command. The OU folder structure is as follows: <code>Windurst &gt; Workstations &gt; Test</code>.</p>
  
  <p>I know this command works on Windows 7, but I haven’t tested it in my lab environment as yet. Going to build a Win 7 machine and post the results. Thanks in advance for any help you can give.</p>
  
  <p>The solution was to run PowerShell as administrator.
  <a href="https://i.stack.imgur.com/fPOoK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fPOoK.png" alt="Running PowerShell as administrator"></a></p>
  
  <p><a href="https://i.stack.imgur.com/mLugZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mLugZ.png" alt="Active Directory Users and Computers"></a></p>