Home Dashboard Directory Help
Search

ConvertFrom-CSV converts the property names as values when using the Header parameter by Arnaud Petitjean


Status: 

Active


1
0
Sign in
to vote
Type: Bug
ID: 777627
Opened: 1/27/2013 10:42:17 AM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

When using ConvertFrom-CSV with -Header to remap the property names, ConvertFrom-CSV generates a list of values including the property names.

Example 1: works as expected

PS > whoami.exe /user /FO CSV | ConvertFrom-Csv

User Name                SID
---------                ---
arnaud-mac-pc\arnaud-mac S-1-5-21-2729936480-2636444230-3151370031-1000

Example 2: does not work as expected

PS > whoami.exe /user /FO CSV | ConvertFrom-Csv -Header @('Name','SecurityID')

Name                     SecurityID
----                     ----------
User Name                SID
arnaud-mac-pc\arnaud-mac S-1-5-21-2729936480-2636444230-3151370031-1000

I know it's written in the doc to omit the header in the CSV string, but it should work as Export-CSV. Export-CSV ignores the header when using the Header parameter. I would expect the same behaviour.

Details
Sign in to post a comment.
Sign in to post a workaround.