Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Adding User In Active Directory gives Error Directory Object not found powershell

$
0
0

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

$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)


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>