Reputation: 111
I use this script to import the csv file and modify it and then export it I want to read the data in column 'Member of' and if string '[Admin...whatever string...]' found, output in column 'Admin Priviledges' should be TRUE else FALSE.
I try with boolean like below:
Import-Csv csvdatacol.csv |
Select-Object Name, Hostname, 'Last Logon Date', 'Member of',
@{n='Admin Priviledges';e={[bool]()}}
Upvotes: 0
Views: 867
Reputation: 200373
Use something like this in the expression for the field "Admin Privileges":
@($_.'Member Of' -replace '^\[|\]$' -split ',') -contains 'Administrators'
Upvotes: 1