Solved

Exception calling "SetInfo" with "0" argument(s):

Posted on 2010-11-21
3
3,187 Views
Last Modified: 2012-05-10
I am trying to create a simple user account with vbscripting, yet I can not because of the following error. Can someone pls show me why the error occurs with Setinfo()?

$objUser=[ADSI]"LDAP://OU=People,DC=pit,DC=com,DC=au"
$objUser=$objOU.Create("user","CN=Scott Mitchell")
$objUser.Put("sAMAccountName","Scott Mitchell")
$objUser.SetInfo()

PS C:\Users\Administrator\Documents> .\newusers.ps1
Exception calling "SetInfo" with "0" argument(s): "There is a naming violation. (Exception from HR
At C:\Users\Administrator\Documents\Newusers.ps1:4 char:17
+ $objUser.SetInfo( <<<< )
0
Comment
Question by:Network_Padawan
  • 2
3 Comments
 
LVL 8

Expert Comment

by:GundogTrainer
ID: 34186596
Can you confirm you have:
1. Sufficient permissions to create account in that OU.
2. The Samaccountname and user are unique and have not already been created.
0
 
LVL 8

Accepted Solution

by:
GundogTrainer earned 250 total points
ID: 34186746
Actually looking at it I have noticed the first line appears to be incorrect as it should define the OU for the user object to be create in.

$objOU=[ADSI]"LDAP://OU=People,DC=pit,DC=com,DC=au"

$objUser=$objOU.Create("user","CN=Scott Mitchell")
$objUser.Put("sAMAccountName","Scott Mitchell")
$objUser.SetInfo()
0
 

Author Closing Comment

by:Network_Padawan
ID: 34187267
Doh! Can't believe I missed that.

Thanks
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Set OWA language and time zone in Exchange for individuals, all users or per database.
Synchronize a new Active Directory domain with an existing Office 365 tenant
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now