0

I am getting data like below

Path              : C:\Program Files\ibm\gsk8\lib64
ModifiablePath    : C:\Program Files\ibm\gsk8\lib64
IdentityReference : BUILTIN\Administrators
Permissions       : {WriteOwner, Delete, WriteAttributes, Synchronize...}

Path              : C:\Program Files\ibm\gsk8\bin
ModifiablePath    : C:\Program Files\ibm\gsk8\bin
IdentityReference : BUILTIN\Administrators
Permissions       : {WriteOwner, Delete, WriteAttributes, Synchronize...}

I had to use Fomat-List to bring the data this way because without this the last column Permissions was not visible. and when I tried Export-csv for the data, the last column coming as System.Object[] Please let me know how to write this data to csv

3
  • You would need to enumerate and loop over the Permissions properties of the objects. What have you tried? Commented Apr 20, 2022 at 14:07
  • We can't tell you, as it depends how you want to handle the Permissions values. Do you want one row per named permission? A semicolon-separated string in a single column? Commented Apr 20, 2022 at 14:07
  • @MathiasR.Jessen: A single column. as it reflects the Permissions for that specific path Commented Apr 20, 2022 at 14:11

1 Answer 1

1

Use Select-Object to create a new calculated property:

... |Select-Object Path,ModifiablePath,IdentityReference,@{Name='Permissions';Expression={$_.Permissions -join ';'}} |Export-Csv -Path path\to\output.csv -NoTypeInformation
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the response.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.