title: Adding User In Active Directory gives Error Directory Object not found powershell
body: <p>Hi every one i am using the following code to add user to active directory but i am getting the error
  Directory object not found</p>
  
  <pre><code>$NewUser = Read-Host "New Username"
  $firstname = Read-Host "First Name"
  $Lastname = Read-Host "Last Name"
  $NewName = "$firstname $lastname"
  
  
  New-ADUser -SamAccountName $NewUser -Name $NewName -GivenName $firstname -Surname   
  $lastname -Path "ou=Users,DC=mydomain,DC=local" -AccountPassword (Read-Host "New Password"   
  -AsSecureString)
  </code></pre>