Solved

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

Posted on 2011-03-15
2
861 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
[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 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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
This process allows computer passwords to be managed and secured without using LAPS. This is an improvement on an existing process, enhanced to store password encrypted, instead of clear-text files within SQL
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 tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
Suggested Courses

630 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