Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Importing a CSV to fill-in some AD fields

$
0
0

Hi,

we  have a large CSV with some additional information for some users. Additional phonenumbers, www-pages etc. 

A sample line from the CSV is this:

name,naam,sAMAccountName,info,mail,xxx,ipPhone,pp,department,mobile,facsimileTelephoneNumber,l,postalCode,telephoneNumber,xxxxx,company,streetAddress,wWWHomePage,homePhone,Kolom1,title
Fred Brandt,Fred Brandt,fbrandt,Fred,fbrandt@XXX.nl,Brandt,a,b,Facilitaire zaken,+31 (0) 6 5571 6568,,Zoetermeer,2718 SG,+31 (0)79 3467,+31 (0)79 346 7800,XXX B.V.,Signaalrood 60,aap.nl,208,c,Medewerker

The command i use is this one:
Import-Csv c:\evo-1.csv | Foreach-object {get-ADUser -filter {name -eq $_.name} | set-aduser -department $_.department -mobile $_.mobile -city $_.l -postalcode $_.postalcode -OfficePhone $_.telephoneNumber -company $_.company -streetaddress $_.streetaddress -HomePage $_.wWWHomePage -homePhone $_.homePhone -title $_.title}

It gives me an error: property name not found in object of type: System.Management.Automation.PSCustomObject. If I isolate only this user and replace the $_.name with only "Fred Brandt" it works. But since i have over 300 users, it is no solution to isolate them all and import the info one by one, anyone who can help me out?

Thanks in advance



Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>