WMI Querying

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 16 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
slinky2000_us
Posts: 2
Last visit: Mon May 21, 2007 1:02 am

WMI Querying

Post by slinky2000_us »

Hi,

I have a script which is below but I want to inverse the like statement. For some reason it will not let me use NOT LIKE. Any Ideas?

Thanks
Dave

WMIQuery = "Select * from Win32_Printer where Local=FALSE and ServerName Like '%xxxprint%'"
User avatar
slinky2000_us
Posts: 2
Last visit: Mon May 21, 2007 1:02 am

WMI Querying

Post by slinky2000_us »

Hi,

I have a script which is below but I want to inverse the like statement. For some reason it will not let me use NOT LIKE. Any Ideas?

Thanks
Dave

WMIQuery = "Select * from Win32_Printer where Local=FALSE and ServerName Like '%xxxprint%'"
User avatar
jhicks
Posts: 1789
Last visit: Mon Oct 19, 2015 9:21 am

WMI Querying

Post by jhicks »

WMI doesn't offer that functionality, although it sure would be handy. One workaround would be to return everything where local=false. Then as you enumerate the returned collection, only use the object if an InStr function, is true for what you are looking for. Or you might use regular expression matching.
This topic is 16 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked