Hello everybody,
I try to filter a csv file with the following statement:
get-qaduser -disabled -searchroot "kl.int/KL-Group" | select-object DN,samaccountname | Export-Csv -Encoding UTF8 -NoTypeInformation $AllDeaktUser
import-csv $AllDeaktUser | ForEach-Object {
if ( ($_.DN -notlike "*,OU=Services,*") -or ($_.DN -notlike "*CN=Phone*") ) {
Add-Content -path $DeaktUser2Move -value $_.DN
}
The purposeof the scriptisthat alllines with the text",OU=Services,"and"CN=Phone*"will be filtered outandwill not be addedto theadjustedlist.
If I use an IF statement with one filter, the script works: if ($_.DN -notlike "*,OU=Services,*")
Have I maybe a wrong syntax? Please help...