[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2010-11-21
3
Medium Priority
?
3,643 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

649 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