Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $property_list = ($csv_import | get-member | where-object { $_.MemberType -eq "NoteProperty" }).name
- # Create the property for the select-object
- $expression_list = $property_list | foreach {
- if ($_ -eq "email") {
- @{
- Name = ('C_{0}' -f $_)
- expression = [Scriptblock]::Create('$_.{0}' -f $_)
- }
- } else {
- @{
- Name = ('{0}' -f $_)
- expression = [Scriptblock]::Create('$_.{0}' -f $_)
- }
- }
- }
- # You dont need to join here, it's allready an array
- #$expression_join = $expression_list -join ","
- # working as expected
- $csv_import | Select-object $expression_list
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement