wmi-query

Issue with perfmon counter value using WMI query

你离开我真会死。 提交于 2019-12-06 05:34:41
I am building EXE and through which i am fetching perfmon counter of application to monitor that using WMI query. I am testing it with my local machine and seems like my code logic gives me incorrect values for some of counters. Below is my code for one of the counter ( CacheTotalHitRatio ) And when i have looked it with perfmon exe in my system then it shows me something different as shown below. I think CacheTotalHitRatio is in percentage and should not be go beyond 100 but my code gives some higher value. What is problem here OR am i doing something wrong here? Please let me know if anyone

Powershell get-item VersionInfo.ProductVersion incorrect / different than WMI

一个人想着一个人 提交于 2019-12-06 02:30:01
问题 I'm trying to understand why Powershell would get back a different version number for a DLL file than what both the file properties page from Windows Explorer, and a WMI query shows. (I apologize in advance if this doesn't correctly qualify as a coding question.) The scenario: Running the following powershell command: (get-item C:\windows\system32\rdpcorekmts.dll).VersionInfo.ProductVersion This returns the following: 6.1.7600.16385 However, this version number is incorrect. When examining

List of WMIEvent classes

∥☆過路亽.° 提交于 2019-12-06 01:56:38
问题 Recently I have been learning about WMI and WQL. I found out the list of Win32 classes (from MSDN) that I can query for but I am not able to find out the list of event classes (should be the subset of the list of Win32 classes isn't it ?) Does any one have a list or some kind of cheat sheet for this? I am jsut asking this out of curiosity. Example for an event class - Win32_ProcessStartTrace 回答1: Here's how to list WMI event classes in the root\cimv2 namespace with C# and System.Management :

Determine Network Adapter Type via WMI

谁说我不能喝 提交于 2019-12-05 18:14:42
问题 I'm using WMI (Win32_NetworkAdapter) and trying to get the details of attached physical network adapters either wired or wireless and avoid virtual adapters, etc. Reading this article it explains that you have to do some clever querying on WMI to eliminate virtual adapters and attempt to only return real physical adapters. Reading this post it explains that you can compare the text in the "Description" of the network adapter to see if it includes "Wireless", "802.11", or "WLAN", if it does,

ManagementException - Invalid Class

爱⌒轻易说出口 提交于 2019-12-05 07:19:48
I am having an issue querying WMI that has me completely baffled. The Application I am building utilizes WMI counters that are installed as part of the VMware View Agent into a VDI desktop. The counters provide information about the remote display protocol PCoIP. I have working code to query the counters: ManagementObjectSearcher searcher = new ManagementObjectSearcher(); ObjectQuery generalQuery = new ObjectQuery("SELECT * FROM Win32_PerfRawData_TeradiciPerf_PCoIPSessionGeneralStatistics"); // Many other queries... searcher.Query = generalQuery; foreach (ManagementObject obj in searcher.Get()

c# 'Invalid class' in a simple WMI query

我是研究僧i 提交于 2019-12-05 02:09:18
I will like to find some result after this query, but in the beginning of the foreach loop, the error "invalid class" occur. string wmiQuery = string.Format("SELECT * FROM Win32_Process"); var searcher = new ManagementObjectSearcher(wmiQuery); var wmiResults = searcher.Get(); foreach (ManagementObject retObject in wmiResults) { Console.WriteLine("[{0}]\tName: {1}", retObject["ProcessID"], retObject["Name"]); } I use window 7 64, and i wonder if Win32_Process exists. I also use wmi code creator download it from http://www.microsoft.com/downloads/en/details.aspx?familyid=2cc30a64-ea15-4661-8da4

List all physical printers using WMI query in Inno Setup

倖福魔咒の 提交于 2019-12-04 20:02:30
I'm trying to get the list of physical printer's name, that are connected to Windows, based on an answer from Query available RAM in Inno Setup . But just get: "Send To OneNote 16". Here is my query: Query := 'SELECT Name FROM Win32_Printer'; Printer := WbemQuery(WbemServices, Query); if not VarIsNull(Printer) then begin Log(Format('Printers=%s', [Printer.Name])); end; You have to iterate the result set: var Query: string; WbemLocator, WbemServices, WbemObjectSet: Variant; Printer: Variant; I: Integer; begin WbemLocator := CreateOleObject('WbemScripting.SWbemLocator'); WbemServices :=

C# WMI reading remote event log

不问归期 提交于 2019-12-04 17:08:53
Im trying to run a WMI query against another computer for errors within the last 5 hours or so. When running a WMI query, shouldnt you at least filter the initial query with a where clause? Im basing my code off of samples generated from the WMI code creator on MSDN Here is the select query im using private ManagementScope CreateNewManagementScope(string server) { string serverString = @"\\" + server + @"\root\cimv2"; ManagementScope scope = new ManagementScope(serverString); return scope; } ManagementScope scope = CreateNewManagementScope(servername); scope.Connect(); SelectQuery query = new

Searching for a File on Remote Machine WMI C#

拜拜、爱过 提交于 2019-12-04 11:46:15
I want to search for a file on remote machine. I don't know the EXACT file path but I know its under C:\Windows\System My query is something like this in WMI string querystr = "SELECT * FROM CIM_DataFile Where Path='C:\\Windows\\System'"; ObjectQuery query = new ObjectQuery(querystr ); ManagementObjectSearcher Searcher = new ManagementObjectSearcher(Scope, query); I get invalid query error. Is the query valid ? Any way to specify Path Under ? You have two issues in your code you must double escape the \ char, because this is a reserved symbol in the WMI the path property must not include the

Powershell get-item VersionInfo.ProductVersion incorrect / different than WMI

让人想犯罪 __ 提交于 2019-12-04 08:52:24
I'm trying to understand why Powershell would get back a different version number for a DLL file than what both the file properties page from Windows Explorer, and a WMI query shows. (I apologize in advance if this doesn't correctly qualify as a coding question.) The scenario: Running the following powershell command: (get-item C:\windows\system32\rdpcorekmts.dll).VersionInfo.ProductVersion This returns the following: 6.1.7600.16385 However, this version number is incorrect. When examining the version information from Windows Explorer, you see the following version (sorry, I tried posting a