Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

here's my scenario. We are looking at installing an application which will extend the AD schema by adding a single attribute to the user class. We then need to bulk upload a value into this field for 1000+ users.

Normally I do a dsquery user script, piping the result into dsmod user, but dsmod user has a limited number of attributes that you can modify. I need to be able to script this as data entry by hand is not viable.

Any suggestions?

Thanks

share|improve this question

2 Answers 2

up vote 1 down vote accepted

I had to do this exact same thing last week. I wanted to fill in the "extensionAttribute" field for multiple users and ended up having to move to Powershell with the quest cmdlets to do this.

This line should give you the bones of what you need to do:

Import-CSV C:\users.csv | ForEach-Object {
Set-QADUser -Identity $_.”username” -ObjectAttribute @{extensionAttribute1=$heading1}}

Where "username" and "heading1" are columns in your users.csv file. The quest cmdlets will let you alter any field in AD as far as I know.

share|improve this answer
    
Thanks, this is roughly what I think I'll end up doing. The problem I have is that the data is from another application, so I actually need to search for the user object using the samid (which is what is in the CSV) –  Matt Apr 5 '11 at 0:46
    
Ok - so how do I get the script to tell me whether the get/set-aduser operation has failed? –  Matt Apr 5 '11 at 5:01
    
Sorry Matt - I'm new to PowerShell so just managed to get the above working - error trapping will come later when I actually need it :) If you do find a solution I'd be grateful to hear it too. –  Kieran Walsh Apr 5 '11 at 9:37

Joe Richards' admod will do what you're looking for. Joe's tools are excellent and you'll do well to look at the rest of his site.

share|improve this answer
    
Thanks, I looked at ADMod (I've used it before) but I really wanted to use dsquery and you need to use his adfind which I was unfamiliar with. I will give it another look. –  Matt Apr 4 '11 at 23:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.