Don't really have a sample script for you... but here are the commands I have used for this kind of thing:
Get the data from the file and loop over it:
$policies= Import-Csv $fileName
ForEach ($policy in $policies) { ...
Within the loop, each column can be referenced using dot notation... for example: $policy.id
To split out columns that have arrays in them I use something like (from a users script I developed), which creates powershell array from the string that you can loop over and manipulate like any other array.
$groups = $legacyUser.'Group Membership'.Split('|')
Or you can sometimes just use pipes if your needs are simple. For example you wanted to remove the user from a group, then rejoin it to rebuild the string:
$groups = ($legacyUser.'Group Membership'.Split('|') | where {$_ -ne 'wrongGroup'}) -join '|'
Sorry... best I can do. I'd share an example where I did this, but what I have is very specialized and would likely take a while for you to make sense of.
Original Message:
Sent: 08-13-2020 05:39 PM
From: Chris Scott
Subject: Powershell snippets to parse policy.csv
Hello,
Working on a PS module to parse out the various fields in the policy.csv (specifically Service and Applets)
Curious if any code examples already exist to avoid needless headache in figuring it out.
Thanks in advance
Chris