Using Powershell 3.0 I'm trying to utilize the following command line's "-filter" option to filter out directories I don't want scanned when I'm trying to pull a list of directories remotely via WMI.
The LIKE option works fine, however I haven't been able to figure out what works for NOT LIKE. I've tried !LIKE, NL, & NOT LIKE. So far, powershell no likey...
Get-WmiObject Win32_Directory -ComputerName "." -filter "name NOT LIKE '%oracle%'" | select name
Let me be clear here. I am aware of the WHERE option that will accomplish this but that option ends up scanning everything, it just doesn't display what you filter out.
Took me a few but i finally figured it out.
Get-WmiObject Win32_Directory -ComputerName "." -filter "NOT name LIKE '%oracle%'" | select name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With