Windows Management Instrumentation (WMI) is an API for managing the Windows operating system on local or remote computers.
Questions tagged [wmi]
4365 questions
13
votes
2 answers
DLL error importing win32api on windows 10
I have python 2.7.2 on windows 10. When I load win32api and wmi it fails to load. The python install on windows 10 is same as on another windows 7 PC. I don't have this issue on win 7. Below are the errors I get when I try to import the above…

user3885927
- 3,363
- 2
- 22
- 42
13
votes
7 answers
How to Read Remote Registry Keys?
I need to be able to read the values in a specific Registry Key from a list of Remote Computers.
I can do this locally with the following code
using Microsoft.Win32;
RegistryKey rkey = Registry.LocalMachine;
RegistryKey…

etoisarobot
- 7,684
- 15
- 54
- 83
13
votes
3 answers
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 documentation I can use
string key = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography";
string r =…

Bart Friederichs
- 33,050
- 15
- 95
- 195
13
votes
1 answer
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 = GetFireWallManager();
bool isFirewallEnabled =…

wjhguitarman
- 1,063
- 1
- 9
- 27
13
votes
3 answers
How Do You Monitor The CPU Utilization of a Process Using PowerShell?
I'm trying to write a PowerShell script to monitor % CPU utilization of a SQL Server process. I'd like to record snapshots of this number every day so we can monitor it over time and watch for trends.
My research online said this WMI query should…

Mark Rucker
- 6,952
- 4
- 39
- 65
13
votes
3 answers
Determine Network Adapter Type via WMI
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…

ScottN
- 1,490
- 2
- 20
- 34
12
votes
4 answers
Determine operating system and processor type in C#
I want to check what type of operating system i use and what kind of processor. this should be check on run time. i tried using
System.Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE")
and
System.OperatingSystem osInfo2 =…

Ben2307
- 1,003
- 3
- 17
- 31
12
votes
2 answers
How to construct WMI query
I'd like to find results that Name starts with param1, and ends with param2 but my code doesn't work
string wmiQuery = string.Format("SELECT CommandLine FROM Win32_Process WHERE Name LIKE '{0}%' AND Name LIKE '%{1}'", param1,…

Saint
- 5,397
- 22
- 63
- 107
12
votes
3 answers
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 log every minute or so to grab the new event logs since I read last time.
Currently I am considering to use C# to implement…

istudy0
- 1,313
- 5
- 14
- 22
12
votes
5 answers
"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 this up a few months ago when the servers were being set up and I believe it was working fine. Now I…

jwynveen
- 1,261
- 3
- 15
- 34
12
votes
3 answers
WMI: Get the list of Installed Softwares
I need to get the list of installed softwares on remote Windows hosts using wmi calls. I have tried using Win32_Product and Win32Reg_AddRemovePrograms Classes.
Advantage of using Win32_Product is that, it displays all the softwares installed on the…

Mandar Shinde
- 1,735
- 4
- 20
- 28
12
votes
1 answer
Get full CPU name without WMI
Does anyone know if it's possible to get the full processor name (as shown in Control Panel | System) without using WMI? I'm guessing there's some unmanaged call you can make.
WMI does the job, but I'm finding it intermittently crashes or locks up…

Joe Albahari
- 30,118
- 7
- 80
- 91
12
votes
2 answers
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 automatically resolves to, rather than a value that would indicate it is dynamic (such as null).
for example,…

Micah
- 429
- 1
- 5
- 11
12
votes
3 answers
Get a user's email address from the username via PowerShell and WMI?
I have a user's network login name. From PowerShell and WMI is it possible to get a valid email for that user? Note that the login name is different than the name in the email, so I can't just combine the login name with the email domain.

Michael Kelley
- 3,579
- 4
- 37
- 41
11
votes
4 answers
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.Format("Setting Machine Name to '{0}'...", newName));
// Invoke WMI to populate the…

N.D
- 1,009
- 5
- 23
- 39