The script that I put together does gather the results I need, but I was hoping to utilize a cleaner string.
After I gather all the needed information, I export the results to a csv file. There are three specific rows I would like to remove, so I re-import the csv file and delete those rows. This is the string I am currently utilizing:
#Remove Unneeded Users
import-csv .\LDAPCrossWalkTable.csv | Where-Object "User ID" -ne 'test' | Where-Object "User ID" -ne 'process' | Where-Object "User ID" -ne 'app' | export-csv .\LDAPCrossWalkTableFinal.csv -Force -NoTypeInformation
Is there a way to use the Where-Object cmdlet one time by using the -or operator rather than pipe 3 separate times? I just can't figure out the correct syntax. Any input it greatly appreciated! Thanks!
UPDATE: Thank you, Olaf, for the prompt response and multiple options! I decided to proceed with this string:
import-csv .\LDAPCrossWalkTable.csv | Where-Object {$_.'User ID' -notin 'test', 'process', 'app'} | export-csv .\LDAPCrossWalkTableFinal.csv -Force -NoTypeInformation