wmi

Wmi win32 classes on x64

I'm developing .net application using wmi and win32_* WQL queries. http://msdn.microsoft.com/en-us/library/aa394084%28VS.85%29.aspx Will such application work on x64? ...

Edit DMI (Manufacturer, install date, part number ) programmatically

Hi! I need to automate computer assembly process and that's why I wanna know if there is any way to edit DMI data: manufacturer name, install date, part number and serial number (for the whole system block). How can I do it? Using WMI the only thing I can do is to check them, but not to edit. ...

What are some common WMI queries

I'm building a C# monitor app which uses WMI to grab some performance details of a remote computer. What are some good WMI queries to grab helpful stats such as CPU load, RAM usage, HDD free space, etc. For example, you can get the CPU load from the property "LoadPercentage" with the query "SELECT * FROM Win32_Processor". What are som...

BaseEvent child classes, does size matter?

Hi If I make a new class which inherits from BaseEvent can I make it as large as I like? What's the practical implications of doing so? I guess increased network traffic if using with MOM but what if I'm monitoring it for short durations of time? Very basic question I'm sure but I'm new to WMI (and stack overflow for that matter) tha...

Better Code Using Jacob and WMI

I am using JACOB to access system information through WMI. I have not found much documentation for WMI and Jacob on the web and was wondering if I could get some help in making the code a little more efficient. Here is the code: String query = "SELECT * FROM Win32_PerfFormattedData_PerfOS_Processor WHERE Name='_Total'"; Variant vColle...

Best method for gathering NTFS file access statistics?

I'd like advice on choosing a method to collect file access statistics on NTFS volumes under Windows Vista and Windows 7 (32 & 64-bit). I'd like to count file create/open, delete, read/write accesses for every file. API hooking is out. I need system-wide counts, and both 32 and 64-bit OS without mucking up the OS. Also, I don't thi...

Get Link Speed - Win32_PerfRawData_Tcpip_NetworkInterface

Hi, I found Determining the network connection link speed and now I am trying to correlate the data from Win32_PerfRawData_Tcpip_NetworkInterface with Win32_NetworkAdapter (or Win32_NetworkAdapterConfiguration). On the class Win32_PerfRawData_Tcpip_NetworkInterface I don't see any index or unique key that I can use to reference Win32_...

Better Performance: WMI vs SNMP?

What has better performance under Windows for retrieving stats like CPU/Memory/Disk usage, etc.? WMI or SNMP? Thanks, Steve ...

WMI query to find PID and VID

My task is to find devices with specified PID and VID by using WMI queries. I have found that Win32_PnPEntity class property PNPDeviceID can be used, which sometimes contains PID and VID. Maybe someone know the good way, please answer then. ...

SQL Server xQuery return NULL instead of empty

So in this example I'm trying to return a NULL instead of an empty nvarchar for element2 and element3. I can't seem to find an answer to this anywhere, or if it's even possible. I know I can check .exists() with a nullif of Case/When, but I'd rather not make that check for the sake of performance. WqlEventQuery query = new WqlEventQue...

Help needed to get Process ID for PsExec.exe in C# ??

Hi, I am using the below code to invoke PsExec.exe which invokes my console application in two servers, I am not able to grab the ProcessId of the invoked processes (my console apps). process.StandardOutput.ReadToEnd()); is only giving me the servernames but not the complete content. Can you please help me to get the process id's ge...

Application hangs after a DataGridView is Populated

I have a simple form with two buttons (Start and Stop) and a DataGridView. I am trying to populate the DataGridView with the results of a WMI query that enumerates Win32_Process instances and puts all process names in the only column of the DataGridView. The code looks like this: using System; using System.Management; using System.Windo...

Has anyone successfully used the WMI Win32_PatchPackage class? (C#)

According to sources here and here, this class should give me a nice and human-readable list of patches applied to Windows. What I want is a list of KB patches applied to a remote machine. ManagementScope scope; ConnectionOptions options = new ConnectionOptions(); options.Username = tbUsername.Text; options.Password = tbPassword.Passwor...

"Access is denied" Exception with WMI

I am working on WMI. I want to access remote system information. The following code is working for loopback or on local host but when I try to access the remote machine it shows the following exception error: Access is denied. (Exception from HRESULT:0X8005(E_ACCESSDENIED)) When switch is used between 2 systems. and The RPC se...

Querying WMI class Win32_QuickFixEngineering returns mucho weirdo timestamps (C#)

Class documentation here. The InstalledOn property is supposed to have a timestamp of (well, duh) when the fix was installed. But the doc doesn't say what's the format. I get something unintelligible, but it clearly means something. "01ca56402c180b70" is very obvious a hex number, but of what? And another thing: why do the first few ite...

How to determine if current user is logged on through Terminal Services in .NET?

I would like to determine, from a .NET application, whether the current user (from System.Environment.UserName) is logged in to the machine physically, or via terminal services. The use case is a startup program launcher. When I'm logging on to my development machine locally I would normally like a host of applications to be started au...

MsBuild Task: Register Com Component on remote/deployed-to machine?

I am currently still fiddling with our msbuild & deployment script and one of the steps is to register a (legacy) com component on the machine the code is deployed to. Is there any 'elegant' way to accomplish this or would I have to call the regsvr32.exe via wmi on the remote machine? ...

C# get date/time a windows service started

Is there a way to get the date/time that a service last started in C#. I'm using this code now to check the status of services: ServiceController sc = new ServiceController(serviceName); // check sc.status for "Running" etc... with a Switch statement... Can I do it with this object? Or need WMI? (Reason: I'm writing a little BizT...

Need RPC call example written in C#

Hi All ! I am dealing with WMI connection errors and timeouts and will try to check the RPC stack first. I found the following C code snippet, but do not understand if and how it works and where I may find further informations or even a sample. RPC_STATUS status; unsigned short *StringBinding; RPC_BINDING_HANDLE BindingHandle; status ...

Powershell Command in C#

I am trying to query the names all of the WMI classes within the root\CIMV2 namespace. Is there a way to use a powershell command to retrieve this information in C# ? ...