Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - create Ad user on local machine

Reply
 
Old 07-15-2009   #1 (permalink)


vista
 
 

create Ad user on local machine

Hey, i would liek a script to create user on local.
my script :

Quote:
$domaineSMTP = "@$env:USERDNSDOMAIN"
$domaineLDAP = "$env:USERDNSDOMAIN"
$domaineLDAP = $domaineLDAP.Replace('.',',DC=')
$domaineLDAP = "DC=$domaineLDAP"
$OU = 'OU=Utilisateurs'
$usersOU = [ADSI]"LDAP://$OU,$domaineLDAP"
$newUser = $usersOU.Create("user","cn=MyNewUser")
$newUser.SetInfo()
error code is :

Quote:
Exception retrieving member "Create": "There is no such object on the server.
"
à : ligne:7 caractère:11
+ $newUser = <<<< $usersOU.Create("user","cn=MyNewUser")
i have already install Quest AD cmdlets

plz help me

My System SpecsSystem Spec
Old 07-15-2009   #2 (permalink)
Chris Dent


 
 

Re: create Ad user on local machine


If you have Quest CmdLets installed why not use "New-QADUser"?

e.g.

New-QADUser "MyNewUser" -ParentContainer "Utilisateurs"

HTH

Chris
My System SpecsSystem Spec
Old 07-15-2009   #3 (permalink)


vista
 
 

Re: create Ad user on local machine

Quote:
f you have Quest CmdLets installed why not use "New-QADUser"?

e.g.

New-QADUser "MyNewUser" -ParentContainer "Utilisateurs"

HTH

Chris
when i try this i have error message to :

Quote:
Cannot resolve DN for the given identity: 'Utilisateurs'
à : ligne:1 caractère:12
+ New-QADUser <<<< "MyNewUser" -ParentContainer "Utilisateurs"
My System SpecsSystem Spec
Old 07-15-2009   #4 (permalink)
Chris Dent


 
 

Re: create Ad user on local machine


Given your previous usage I had assumes Utilisateurs existed as an OU in
the root of your AD domain.

You'll need to confirm the path to that, parentContainer can be passed
either like this:

yourdomain.com/OU1/OU2

Or like this:

ou=OU2,ou=OU1,dc=yourdomain,dc=com

But the parentContainer must exist.

Chris


epiouf wrote:
Quote:
Quote:

>> f you have Quest CmdLets installed why not use "New-QADUser"?
>>
>> e.g.
>>
>> New-QADUser "MyNewUser" -ParentContainer "Utilisateurs"
>>
>> HTH
>>
>> Chris
>
> when i try this i have error message to :
>
Quote:

>> Cannot resolve DN for the given identity: 'Utilisateurs'
>> à : ligne:1 caractère:12
>> + New-QADUser <<<< "MyNewUser" -ParentContainer "Utilisateurs"
>
>
My System SpecsSystem Spec
Old 07-15-2009   #5 (permalink)


vista
 
 

Re: create Ad user on local machine

now i connect to my computer like this :
Quote:
LOCALDEV\dev
$domaineLDAP = "LOCALDEV"
$OU = 'OU=Utilisateurs'
$usersOU = "$domaineLDAP,$OU"

new-QADUser -ParentContainer $usersOU -name 'adduser1' -sAMAccountName 'gadduser1'

error message :

Quote:
Cannot resolve DN for the given identity: 'LOCALDEV,OU=Utilisateurs'
My System SpecsSystem Spec
Old 07-15-2009   #6 (permalink)
Chris Dent


 
 

Re: create Ad user on local machine


The path you're supplying is not valid.

If you see this in AD Users and Computers:

yourdomain.com
| - FirstOU
| - SecondOU

Then the distinguished name would be:

OU=SecondOU,OU=FirstOU,DC=yourdomain,DC=com

You can also express that in the canonical name format:

yourdomain.com/FirstOU/SecondOU

Note that with the second format the "OU=" prefixes are not necessary.

If the container / OU you're using is the default Users container then
the distinguished name becomes:

CN=Users,DC=yourdomain,DC=com

Chris

epiouf wrote:
Quote:

> now i connect to my computer like this :
Quote:

>> LOCALDEV\dev
>
> $domaineLDAP = "LOCALDEV"
> $OU = 'OU=Utilisateurs'
> $usersOU = "$domaineLDAP,$OU"
>
> new-QADUser -ParentContainer $usersOU -name 'adduser1' -sAMAccountName
> 'gadduser1'
>
> error message :
>
Quote:

>> Cannot resolve DN for the given identity: 'LOCALDEV,OU=Utilisateurs'
>
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Create local user from sysprep VB Script
login to local machine Vista account administration
How to get the Local Machine Name VB Script
Add local machine users to local admin group via GPO .NET General
cannot copy files onto local machine Vista installation & setup


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46