Solved

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

Posted on 2010-11-21
3
3,317 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Utilizing an array to gracefully append to a list of EmailAddresses
Synchronize a new Active Directory domain with an existing Office 365 tenant
This tutorial will give a an overview on how to deploy remote agents in Backup Exec 2012 to new servers. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as connecting to a remote Back…
This tutorial will walk an individual through locating and launching the BEUtility application and how to execute it on the appropriate database. Log onto the server running the Backup Exec database. In a larger environment, this would generally be …

830 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