new to PowerShell here, learning a lot from google, etc.
I'm trying to write a loop that catches all "Employee_Name" that are stated as null and "Revoked" under the "Approval" column and puts them into a Variable.
I know there is probably an easy solution for that, but I could find anything on the web regarding multiple-value queries.
this is my code:
$ListDataCollection = Import-Csv -Path "C:\Temp\FinalListData.csv"
$users_to_disable = @();
$ListDataCollection | ForEach-Object {
if ([string]::IsNullOrEmpty($_.Approval)) {
$users_to_disable += $_.Employee_Name
}
if ($_.Approval -eq "Revoke") {
$users_to_disable += $_.Employee_Name
}
}
$users_to_disable
and when I try to run it, the result is empty. it just shows the variable I'm using and not showing any data.