tagged [wmi]

Which approach is better to read Windows Event log in C#? WMI or EventLog

Which approach is better to read Windows Event log in C#? WMI or EventLog I need to write an application to grab event log for System/Applications. The other requirement is that I need to read event l...

23 Mar at 20:46

How to remotely control a Windows Service with ServiceController?

How to remotely control a Windows Service with ServiceController? I'm trying to control Windows Services that are installed in a remote computer. I'm using the `ServiceController` class. I have this: ...

rename computer programmatically c# .net

rename computer programmatically c# .net I need to rename my computer via .net application. I have tried this code: ``` public static bool SetMachineName(string newName) { MessageBox.Show(String.For...

15 Apr at 16:6

How do I get total physical memory size using PowerShell without WMI?

How do I get total physical memory size using PowerShell without WMI? I'm trying to get the physical memory size using PowerShell, but without using get-wmiobject. I have been using the following PS c...

29 Oct at 02:16

How can I get the CPU temperature?

How can I get the CPU temperature? I need to gather some system information for the application I'm developing. The memory available and the CPU load are easy to get using C#. Unfortunately, the CPU t...

11 Jun at 16:35

How to check if DNS server is set to 'obtain automatically'

How to check if DNS server is set to 'obtain automatically' When I get my servers DNS settings using the DNSServerSearchOrder property of my network card's settings, it returns the DNS server that it ...

13 Nov at 19:23

Getting Windows serial number (was: Getting MachineGuid from Registry)

Getting Windows serial number (was: Getting MachineGuid from Registry) I am trying to fetch `MachineGuid` from the registry, to create some level of binding with the OS for my license system. From the...

8 Jan at 11:31

How to determine Windows.Diagnostics.Process from ServiceController

How to determine Windows.Diagnostics.Process from ServiceController This is my first post, so let me start by saying HELLO! I am writing a windows service to monitor the running state of a number of o...

15 Oct at 18:25

WMI to reboot remote machine

WMI to reboot remote machine I found this code on an old thread to shutdown the local machine: ``` using System.Management; void Shutdown() { ManagementBaseObject mboShutdown = null; ManagementCla...

27 May at 20:13

How to connect to a remote Windows machine to execute commands using python?

How to connect to a remote Windows machine to execute commands using python? I am new to Python and I am trying to make a script that connects to a remote windows machine and execute commands there an...

Remote WMI query slow

Remote WMI query slow I'm working on a program that queries three different servers in order to get CPU and LogicalDisk information. Each server I query returns me values in 6 to 15 seconds (depending...

3 Mar at 08:11

Monitoring batch requests per second on SQL Server through WMI

Monitoring batch requests per second on SQL Server through WMI I need to programmatically (.NET 3.5, C#) monitor a SQL Server 2008 machine through WMI. I want to measure the number of batch requests p...

How to check if windows user has a password set?

How to check if windows user has a password set? I didn't know it would be this difficult to figure out but here I am. I'm developing a net support client which has to detect if the current logged in ...

2 Jul at 11:59

Finding information about all serial devices connected through USB in C#

Finding information about all serial devices connected through USB in C# My project requires detection of a specific device when it is connected to USB. The only way I can identify this device is by i...

8 Oct at 17:21

"The RPC server is unavailable" using WMI query

"The RPC server is unavailable" using WMI query I have a workgroup of web servers running Server 2008 R2 in which I'm trying to manage a script that checks the disk space of all of them. I had set thi...

13 Nov at 10:51

How to identify what device was plugged into the USB slot?

How to identify what device was plugged into the USB slot? I want to detect when the user plugs in or removes a USB sound card. I've managed to actually catch the event when this happens, but I can't ...

23 May at 11:48

C# Get working directory of another process

C# Get working directory of another process I want to determine the absolute path of files used by a known process by reading the command line. Currently, the process is started with relative paths in...

1 Feb at 22:31

High Performance Event Log

High Performance Event Log So I've been trying various ways to get Event Log data in bulk (1000+ records/second). I need something that can filter out old logs, right now I store the last recorded eve...

31 Oct at 04:9

Network Authentication when running exe from WMI

Network Authentication when running exe from WMI I have a C# exe that needs to be run using WMI and access a network share. However, when I access the share I get an UnauthorizedAccessException. If I ...

17 May at 03:21

Check for Third Party Firewalls on a Machine

Check for Third Party Firewalls on a Machine I am working on doing a check for Firewalls. The following code quite easily checks the status of the default Windows Firewall: ``` INetFwMgr manager = Get...

WMI, negative CPU usage value and Timestamp_Sys100NS in past

WMI, negative CPU usage value and Timestamp_Sys100NS in past I am monitoring some machines using WMI, using .NET's `System.Management` stuff. The query I am using is this: From that I compute the CPU ...

5 Feb at 19:40

Find USB drive letter from VID/PID (Needed for XP and higher)

Find USB drive letter from VID/PID (Needed for XP and higher) So I thought I would include the final answer here so you don't have to make sense of this post. Big thanks to Simon Mourier for taking th...

23 May at 12:6

Using clause fails to call Dispose?

Using clause fails to call Dispose? I'm using Visual Studio 2010 to target .NET 4.0 Client Profile. I have a C# class to detect when a given process starts/terminates. For this the class uses a Manage...

12 Aug at 08:22