Solved

@footech - Help with existing Powershell script for adding new users into AD.

Posted on 2012-12-21
1
278 Views
Last Modified: 2012-12-27
@footech - I am actually having trouble with your input to get my script to work.  Based on what you said, I modified my script to look like this:  

Import-Csv .\newusers.csv | foreach { New-ADUser -Name $_.Name -SamAccountName $_.SamaccountName -UserPrincipalName $_.Userprincipalname -GivenName $_.GivenName -Surname $_.Surname -StreetAddress $_.StreetAddress -City $_.City -State $_.State -PostcalCode $_.PostalCode -OfficePhone $_.OfficePhone -MobilePhone $_.MobilePhone -AccountPassword (ConvertTo-SecureString "Windows@123" -AsPlainText -Force) -Enabled $true }

and the attached .CSV file is the input file.  What am I missing?  It keeps telling me that "Import-Csv : Cannot process argument because the value of argument "name" is invalid. Change the value of the "name" ar
gument and run the operation again.
At line:1 char:11"
newusers.csv
0
Comment
Question by:ChicagoTransplant
1 Comment
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
Comment Utility
There was a empty column after UserPrincipalName which is causing error as it does not have a valid header. Attached the sample csv..
sample.csv
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Disabling the Directory Sync Service Account in Office 365 will stop directory synchronization from working.
Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
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…

763 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

12 Experts available now in Live!

Get 1:1 Help Now