Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2011-03-15
2
Medium Priority
?
864 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 2000 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

Lessons on Wi-Fi & Recommendations on KRACK

Simplicity and security can be a difficult  balance for any business to tackle. Join us on December 6th for a look at your company's biggest security gap. We will also address the most recent attack, "KRACK" and provide recommendations on how to secure your Wi-Fi network today!

Question has a verified solution.

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

High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
Transferring FSMO roles is done when an admin wants to split roles between certain Domain Controllers or the Domain Controller holding the Roles has been forcefully demoted using dcpromo / forceremoval
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

927 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