The simple query works fine in PowerShell:
gwmi -Query "select * from Win32_DependentService where Antecedent='\\\\MYPC\\root\\cimv2:Win32_SystemDriver.Name=`"WdFilter`"'"
but it doesn't work in C#:
var scope = new ManagementScope("\\\\MYPC\\Root\\Cimv2");
scope.Connect();
var searcher = new ManagementObjectSearcher(scope, new ObjectQuery("select * from Win32_DependentService where Antecedent = '\\\\MYPC\\root\\cimv2:Win32_SystemDriver.Name=\"WdFilter\"'"));
ManagementObjectCollection queryCollection = searcher.Get();
var count = queryCollection.Count; // "Invalid query" exception here!!!
What is wrong with C# query? Thanks!