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

Importing attribute from a CSV to AD for multiple users

$
0
0

Hi All,

I have searched around for an answer to this and tried it on our test domain with a test CSV file, but can't get it to work. So I apologize if the answer is out there, but I'm unable to get this resolved. What I have is a CSV file with two columns at the top "USER_NAME" and "ExtensionAttribute1". Below the two columns are data for many users, the USER_NAME is their sAMAccountName and the ExtensionAttribute1 is a value (PIN #) that I want to go in their ExtensionAttribute1 attribute. I am using Import-CSV. I created 5 test accounts on our test domain so I could test this. I'm trying to run this from the active directory powershell module.

I can run import-CSV C:\testimport.csv and get the output of the file fine. Then I run this next powershell command and just get a prompt like this and nothing else, <<

Import-CSV C:\Testimport.csv | foreach{
Get-ADUser -Filter {(sAMAccountName -eq $_.USER_NAME) | Set-ADUser -extensionAttribute1 $_.extensionAttribute1

Do I need to run part of this command first and then the second part of the command after? Or can I run it all at once, but I'm messing something up? I ask this because when I run the command, like I said, I get this "<<" but no errors. Any help would be greatly appreciated, I can provide any more information that you may need.

Thanks!

-Scott


Viewing all articles
Browse latest Browse all 21975

Trending Articles



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