Solved

How to import employeeNumber from CSV into AD

Posted on 2013-06-07
7
780 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
[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
  • 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
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…

737 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