In my console application (.NET), I execute a WMI request as follows:
ManagementObjectSearcher query; ObjectQuery oq; ManagementObjectCollection objectCollection; try { oq = new ObjectQuery("SELECT TotalVisibleMemorySize, FreePhysicalMemory FROM Win32_OperatingSystem"); query = new ManagementObjectSearcher(oq); objectCollection = query.Get(); } catch { return null; } return objectCollection;
I am splitting data collected for use in my application. It currently works great for me.
I am using multiple wmi requests for my application. To make one method to execute all my wmi requests from config, I will need to do the division in the select clause of the request. I need to execute a WMI request, for example:
SELECT ((TotalVisibleMemorySize)/1024) as TotalVisibleMemorySize1, ((FreePhysicalMemory)/1024) as FreePhysicalMemory1 FROM Win32_OperatingSystem
For this query, I get an Invalid query error.
Is there a syntax error in this query or is it not possible to split in the select clause of a WMi request?
source share