wmi

Problem with Win32_PhysicalMedia SerialNumber property.

I wrote the following code to get the physical media serial number but in one of my computers it returns null instead. Does anybody know what the problem is? Thanks. var searcher = new ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia"); foreach( ManagementObject mo in searcher.Get() ) { Console.WriteLine("Serial: {0}", mo...

What format is this time value in?

I have a WMI query that specifies time in this format '20090219000000.000000+480' Can someone tell me what format this is, and does .NET have any built-in functionality to work with it? EDIT This time value is from a sample query that I found. I don't know what time value was used to generate it. I just need to be able to convert a ti...

A few WMI problems

Hi guys! I have two questions: How would I use the WMI to determine the type of hard drive present on the computer? I'm currently using the Win32_DiskDrive Class, and calling the InterfaceType property, however, it reports SATA hard drives as IDE. Is there any way of correctly determining the type of hard drive present? I am trying...

Where does WCF log the stuff if wmi is enabled?

<system.serviceModel> <diagnostics wmiProviderEnabled="true"> I recently stumled across this setting in WCF, where you can enabled WMI logging. Where does it log to? and what is logged? There is no mention of that.. Pleaselet me know... ...

How can i get HardwareIds CompatibleIds using WMI, IoGetDeviceProperty

Hello all! I'm use .net framework 3.5, Does anybody know how cam i get HardwareIds and CompatibleIds for device using WMI. for example i can get device info using this code (WMI): ManagementObjectSearcher searcher = new ManagementObjectSearcher("select * from " + "Win32_VideoController"); foreach (ManagementObject sha...

How to determine OS Platform with WMI?

I am trying to figure out if there is a location in WMI that will return the OS Architecture (i.e. 32-bit or 64-bit) that will work across "all" versions of Windows. I thought I had figured it out looking at my Win2k8 system when I found the following: Win32_OperatingSystem / OSArchitecture I was wrong. It doesn't appear that this ...

WMI Get All Monitors Not Returning All Monitors

I am using WMI Win32_MonitorDesktop to get all the monitors on the system. However it only returns one. I have tried it on several computers, and they deffinately have multiple monitors on them, connected and working. ManagementObjectSearcher monitorObjectSearch = new ManagementObjectSearcher("SELECT * FROM Win32_DesktopMonitor"); for...

Why are WMI Queries so slow sometimes?

I am using System.Management namespace in a .Net to execute various WMI queries against a remote server. In my logs I can see that sometimes the queries take 30 or 40 seconds to complete while other times the queries complete in less than a second. When I see these slow queries, I try to connect to the box using wbemtest, but it always...

How to obtain data from WMI using a C Application??

Hi, I have a pure C application that issues IOCTL calls to my adapter driver and displays info ,this is however compiled using Visual Developer Studio 5(non-managed code) ... I need to get some info however from my adapter using WMI .... My googling efforts show that i would need to write a C++ Application using COM to achieve any fo...

How to add new DNS zone on Windows Server 2008 using API or PowerShell?

Is there any API in Microsoft DNS Server 2008 to add new forward DNS using VBScript or PowerShell or P/Invoke or WMI? It's easy to generate plain text file and put it into \system32\dns. How to replace a number manual commands in MMC with just a script execution? ...

How to execute a batch file on a remote computer?

I would like to be able to run a batch file on a remote computer after a build, where the build output and batch file are living on the build machine. In other words, i want the batch file that is running on the remote computer to be located on the build server, available through a UNC path. I've looked at WMI (System.Management) names...

How to check if a CD-ROM is real or virtual

I am using the following WMI query to enumerate the CD/DVR drives on my machine: select * from Win32_CDROMDrive Question: Is there any way I can detect which of the drives returned are actual, physical CD/DVD drives and which are virtual (e.g. Deamon Tools, MagicDisc)? ...

Windows impersonation for WMI calls via python?

I'm using PyWin32 to make WMI calls to the system in python from my django web application. My goal is to allow users to add printers to the system via a web interface. To do this, I'm using win32print.AddPrinterConnection. This works well running the development server under my user account. I can add all the printers I want. However, ...

WMI error with a simple query in C#

I am trying to use this code on Windows 2000: foreach (Process p in Process.GetProcesses()) { if (p.MainModule.FileName.EndsWith("calc.exe")) { using (ManagementObjectSearcher mos = new ManagementObjectSearcher( "SELECT CommandLine,ExecutablePath FROM Win32_Pr...

How to know the CPU and memory usage of a process with WMI?

I am using a wmi and python in order to track the behavior of the process running on my machine. from win32com.client import GetObject wmi = GetObject('winmgmts:') processes = wmi.InstancesOf('Win32_Process') for process in processes: print process.ProcessId, process.Name The Win32_Process has a lot of information but I don't s...

PowerShell: how to get detailed information about a WMI event?

I'm learning PowerShell 2.0 on Windows 7. My task is simple: I want to listen for a WMI event and then display some information about it. Here is what I'm currently doing: Register-WmiEvent -class win32_ProcessStartTrace -sourceIdentifier processStart Wait-Event It seems to work. Indeed, I get this when I start a process: ComputerN...

How can I programmatically detect a Window's network adapter's duplex state?

I am using WMI to detect a number of items about a network adapter's state. Among the things I need to find out are (a) speed and (b) duplex. I have been able to detect the speed of a network adapter by using WMI and the following Python code: from pycom.client import wmi dev_name = r"\\DEVICE\\{287EB4BB-5C2A-4108-B377-15E1D0B0E760}"...

how can i get get the MACaddress of all the NICs on my PC using WMI

HI all, I am trying to modify the code provided by MS try to access the the Network Adapter Configuration I am getting null pointer exception in it when i try to access the Mac Address or IPAddress property im using VC++ 2005. check for the // exception here: vtProp is returned as NULL line where am getting the exception. #define _W...

problem with wmi

i use this code in article http://www.geekpedia.com/tutorial233%5FGetting-Disk-Drive-Information-using-WMI-and-Csharp.html but it not work on my machine (russian xp sp3) what the problem? i need to get id hdd or mother board to prevent copy my program on other computers here is exception http://www.magicscreenshot.com/jpg/xwMD77wLW...

What determines the order for sound devices in windows when using winmm.dll?

I am trying to use NAudio to create a multiple sound output application. We have 8 USB sound cards installed. NAudio lets me use all 8 but I can't figure out a pattern for determining which device index is which card. The cards will be hooked up to different hardware so it is important to make sure you know which card you are using. ...