The code should look like this
Main Topics
Browse All TopicsI am trying to write a script that logicaly does the following:
Gets all Unique Employee ID within AD and output to a CSV - tick
Get the data from an HR database dump in a format that I can use - tick
Loop through each Unique employee ID and pull the relevant columns from the HR data dump - Can't get this to work
Output all the Unique employee id's with the relevant HR data in a CSV that I can use to upload the data to AD. (I have the upload script working but can't get the input)
Below is what I have so far - If I only have 1 employee ID in Unique1.txt and 1 line of data in HRDATA.csv it works but if I have more data it does seem to work.
Also I think my logic might be slightly out in the if than else loop.
Any help would be great!!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hi JK-PBS
Thanks for getting back to me, unfortunetly Export-CSV does not have an append option so this doesn't work.
Error Below:
A parameter cannot be found that matches parameter name 'append'.
At :line:28 char:110
+ } )| Export-Csv c:\temp\PowerShell\inputfo
Any other ideas?
Export-CSV will always overwrite. There is no Append option.
Is this what you're after?
It takes each of the unique employeeID values and matches them up to lines from HRData. Then writes the line from HRData out to the CSV file.
Did you need it to add in any fields from the User (formerly $Unique)?
Chris
Business Accounts
Answer for Membership
by: JK-PBSPosted on 2009-09-08 at 16:23:41ID: 25287035
You Need to add " -append" to the end of the string that Exports to the .CSV file.
Without it as it gathers new names it erases the old one. With the -append switch it will only add to the file.