Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

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

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

Microsoft Office 365 is a subscriptions based service which includes services like Exchange Online and Skype for business Online. These services integrate with Microsoft's online version of Active Directory called Azure Active Directory.
Active Directory can easily get cluttered with unused service, user and computer accounts. In this article, I will show you the way I like to implement ADCleanup..
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

704 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