Solved

I want my script to grab the rootdse and create the accounts that OU

Posted on 2011-03-15
2
847 Views
Last Modified: 2012-05-11
I want my script to grab the rootdse and create the accounts that OU

this is what I have now

add-pssnapin quest.activeroles.admanagement
$location = get-location
$RootDSE = get-qadrootdse | select-object DefaultNamingContextDN
Import-CSV "$Location\DCESAPUsers.csv" |`
ForEach-Object { New-QADUser -Name $_.Name -SamAccountName $_.Name -ParentContainer OU=Accounts,$RootDSE ; enable-QADUser $_.name }

if I run that it errors out with this:


New-QADUser : Cannot convert 'System.Object[]' to the type 'Quest.ActiveRoles.ArsPowerShel
lSnapIn.Data.IdentityParameter' required by parameter 'ParentContainer'. Specified method
is not supported.
At line:4 char:84
+ ForEach-Object { New-QADUser -Name $_.Name -SamAccountName $_.Name -ParentContainer <<<<
  OU=Accounts,$RootDSE ; enable-QADUser $_.name }
    + CategoryInfo          : InvalidArgument: (:) [New-QADUser], ParameterBindingExcepti
   on
    + FullyQualifiedErrorId : CannotConvertArgument,Quest.ActiveRoles.ArsPowerShellSnapIn
   .Powershell.Cmdlets.NewUserCmdlet
 

_______________________________________________________________________________________
0
Comment
Question by:ntr2def
2 Comments
 
LVL 13

Accepted Solution

by:
soostibi earned 500 total points
ID: 35144884
Bugs:

$RootDSE = get-qadrootdse | select-object -expandproperty DefaultNamingContextDN
Import-CSV "$Location\DCESAPUsers.csv" |`
ForEach-Object { New-QADUser -Name $_.Name -SamAccountName $_.Name -ParentContainer "OU=Accounts,$RootDSE" ; enable-QADUser $_.name }

0
 
LVL 1

Author Closing Comment

by:ntr2def
ID: 35148824
awesome thanks so much
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

Suggested Solutions

Utilizing an array to gracefully append to a list of EmailAddresses
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
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…
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 …

911 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

16 Experts available now in Live!

Get 1:1 Help Now