Question:
Hi I have a script that reads a csv file, creates a json file, checks the users in the file against a service, then i get the result as a json file. I take that result and finds the users i csv file and creates a new file. I do that with a where-objectBut i need to add some extra values on every user before i export it to csv
This is my 2 lines for finding users and then export
Is that possible or do i need to do a for each?
Cheers
Answer:
Assuming I’ve interpretted your question correctly, you should be able to use PowerShell’s Calculated Properties for this purpose.For example, if you wanted to add a field called “Date” and set the current Date/Time to each user row, you could do the following:
Expression
value can either be a static value such as “StaticValue”, a variable such as $i (useful if used as part of a loop, for example) or more complex value that is returned from other cmdlets (as in my example above)If you have better answer, please add a comment about this, thank you!