2

I need a wmic script to delete all printers where the DeviceID Not Like '%%KM%%'

The following syntax works to delete where like

printer where "DeviceID LIKE '%%KM%%'" delete

when I change to

printer where "DeviceID NOT LIKE '%%KM%%'" delete

I get ERROR:

Description = Invalid query

How should I make this change?

Divyang Desai
  • 7,483
  • 13
  • 50
  • 76
FWool
  • 21
  • 1
  • 3

1 Answers1

2

Try:

wmic printer where "deviceid like '%<Name>%'" delete

Updated

wmic printer where "NOT deviceid like '%<Name>%'" delete
Amit Shakya
  • 1,396
  • 12
  • 27