Solved

How to import employeeNumber from CSV into AD

Posted on 2013-06-07
7
758 Views
Last Modified: 2013-06-07
:(
I think i lost the script that allows me to import/add the employeNumber from a CSV into AD Users
The csv has the following headers
SamAccountName,Surname,GivenName,Name,Department,Title,TelephoneNumber,Employee
Number

Open in new window

Just in case the following:
$AD = Get-ADUser -SearchBase "OU=COMPANY,DC=,DOMAIN=COM" -filter * -Properties sAMAccountName,sn,givenName,title,employeeNumber | Where { $_.DistinguishedName -notmatch "OU=VIP" -and $_.DistinguishedName -notmatch "OU=DA"} | Select-Object  sAMAccountName,sn,givenName,title,employeeNumber

Open in new window

0
Comment
Question by:namerg
  • 4
  • 3
7 Comments
 

Author Comment

by:namerg
ID: 39230370
I think, I got it.
Clear-Host
$Ceridian = Import-Csv "c:\scripts\ceridian\CeridianUsersClockNumberPopulate.csv"
Foreach ($Ceridian_User in $Ceridian){
#SamAccountName,Surname,GivenName,Name,Department,Title,TelephoneNumber,EmployeeNumber
	write-host "From Ceridian"
	write-host $Ceridian_User."SamAccountName" $Ceridian_User."Surname" $Ceridian_User."GivenName" $Ceridian_User."EmployeeNumber"
	Get-ADUser $Ceridian_User.sAMAccountName  | Set-ADUser -employeeNumber $Ceridian_User."EmployeeNumber" -ErrorAction SilentlyContinue -ErrorVariable Err1
	write-host "EmployeeNumber SET Sleeping 5 seconds"
	write-host ""
	start-sleep 5
}

Open in new window

0
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
ID: 39230624
Following code also will do...
Import-Csv "c:\scripts\ceridian\CeridianUsersClockNumberPopulate.csv" | %{
Set-ADUser $_.sAMAccountName -employeeNumber $_.EmployeeNumber -ErrorAction SilentlyContinue -ErrorVariable Err1
}

Open in new window

0
 

Author Comment

by:namerg
ID: 39230663
Hi Subsun, need advice, for this script that i am writing, i did a bullet proof but some other issues came up should i post it as a project ?

Thanks for your help,
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 40

Expert Comment

by:Subsun
ID: 39230674
yes please..if it is related to this question then you can post it here itself..
0
 

Author Comment

by:namerg
ID: 39230681
I mean the whole script/project, it is related to multiple questions that you and footech have contributed. Can i submit it as a project ?
0
 
LVL 40

Expert Comment

by:Subsun
ID: 39230687
Yes you can.. Please explain it in detail.. :)
0
 

Author Comment

by:namerg
ID: 39230690
jajaj, yes I will
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

Utilizing an array to gracefully append to a list of EmailAddresses
I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

856 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