Solved

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

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Synchronize a new Active Directory domain with an existing Office 365 tenant
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 configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

708 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

17 Experts available now in Live!

Get 1:1 Help Now