wmi

Using WIX to install a WMI provider.

I have developed a WMI provider in C# using the System.Management.Instrumentation namespace. I need to install the provider into the GAC and register it with the WMI repository using MSI. How might I accomplish this with WIX? ...

Win32_PerfFormattedData_RemoteAccess_RasPort WMI class on Windows XP

I'm getting 'Invalid class name' exceptions when trying to monitor changes to the Win32_PerfFormattedData_RemoteAccess_RasPort class on Windows XP. I'm using the code listed here. Is this class supported on XP? The documentation claims it is, although it's supplied by a different provider. If not, what's a good alternative? ...

Best way to programmatically configure network adapters in .NET

I have an application written in C# that needs to be able to configure the network adapters in Windows. I have this basically working through WMI, but there are a couple of things I don't like about that solution: sometimes the settings don't seem to stick, and when the network cable is not plugged in, errors are returned from the WMI ...

Hanging VBScript on query.

I inherited a piece of code from a recently-retired colleague that gets the total physical memory on a box and, when I perform the following on Windows XP and Server 2003, it works fine: memSize = 0 set colItems = wmi.execQuery("select * from Win32_LogicalMemoryConfiguration") for objItem in colItems memSize = memSize + objItem.Tota...

how to hook to events / messages in windows using python

in short: i want to intercept suspend/standby messages on my laptop, but my program doesn't receives all relevant messages. background: there's a bug in ms-excel on windows xp/2k, which prevents system suspend if a file is opened on a network/usb drive. i'm trying to work-around it programmatically (my toolbox include python, vb6, or...

WMI query for Win32_BaseBoard returns no results

The following C++ code to retrieve the motherboard info via WMI works on most machines, except one: IEnumWbemClassObject* pEnumerator = NULL; hres = pSvc->ExecQuery( bstr_t("WQL"), bstr_t("Select * from Win32_BaseBoard"), WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, NULL, &pEnumerator); if (FAILED(hres)) { // handl...

Get current memory utilisation of a process running on a remote machine with WMI.

I want to write a VB script that will return the current memory utilisation of a process on a remote machine. I'm currently getting the info by greping the output of pslist.exe but that's not ideal. ...

How can I determine the amount of free space of a CD-ROM?

I am attempting to determine the amount of free space a CD has using the following code: ManagementObjectSearcher searcher = new ManagementObjectSearcher("select * from Win32_LogicalDisk WHERE DriveType =5"); foreach(ManagementObject mo in searcher.Get()) { Console.WriteLine( "FreeSpace: "+mo["FreeSpace"].ToString()); Console.Wr...

COM vs WMI for Information providing

What is better method to use if I would like to provide the user with some information about my Hardware device. Should I develop a proprietary COM Library or should I develop a WMI provider? ...

VBS Computer Info Script

Can someone help me modify this please? Instead of the dialog box appearing at the start to ask for computer ID/Name, is there anyway for this to be automatically put in, so its all automatic? And at the end, not to open the file, just to have it stored on the hdd (same dir as script) On Error Resume Next Const HKEY_CURRENT_USER = &H800...

CPU Usage using WMI & C#

How can i retrieve the current CPU usage in c# using WMI? I've seen plenty of posts using performance counters, but I need a solution that can work with remote machines. I've also found a VB solution here, but I'd prefer to accomplish this in C# if possible. ...

Problem retrieving Hostaddress from Win32_TCPIPPrinterPort

I'm running into an odd issue retrieving printer port addresses. When I get all the entries in Win32_TCPIPPrinterPort, the HostAddress field (which should have the IP address) is usually blank/null, only the port name has a value. To make it a bit stranger, if a particular port is not in use by any printer, THEN the HostAddress will have...

Need to close a windows that does not show in process list via Visual Basic Script

I need to close down a VPN window using visual basic script. My normal port of call would be too look through the process list and close the correspoding process. Unfortunately this does not work in this case as the associated process is explorer.exe! Is there anyway to achieve this? ...

WMI Win32_Process.Create fails with Insufficient Privs

I'm trying to run a simple cmd utility on a remote Windows server from within a vbscript by invoking the Win32_Process class, like so: serverIP = "10.0.0.3" Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & serverIP & "\root\cimv2:Win32_Process") RunCommand = "cmd.exe /c echo hello >c:\hello.txt" wscript.echo RunComm...

how can I decode the REG_BINARY value HKLM\Software\Microsoft\Ole\DefaultLaunchPermission to see which users have permission?

Hello, I am trying to find a way to decode the REG_BINARY value for "HKLM\Software\Microsoft\Ole\DefaultLaunchPermission" to see which users have permissions by default, and if possible, a method in which I can also append other users by their username. At work we make use of DCOM and for the most part we always give the same users pe...

How to create a WMI filter in a GPO via C#

I'm trying to create a GPO programatically using the GPMC COM object via C# code. I can create the GPO, but I'm having trouble "inserting" a WMI filter with the GPO. Does anyone know how I can create/update WMI filters for GPOs? ...

How to enumerate all ActiveX elements with WMI?

Is it possible to enumerate all (or just enabled) ActiveX elements (*.dll, *.ocx) with WMI script? Motivation: ActiveXHelper ...

Controlling power to PCMCIA slot/card

I'm currently working on a project that utilizes a proprietary PCMCIA radio card to communicate with some wireless devices. I currently have a background process that handles reading data to and from the card and storing it for processing, but I'd like to be able to shut down power to the card when my application is not running. I've don...

Retrieve current mixer levels with WMI?

Is there a way to get Windows audio mixer levels using WMI? For example, to get the current line input level. Ideally this would work on XP and Vista, although I'm aware the audio subsystem is completely different between the two, so I might need a different solution for each. Edit: suggestions in any language will do. ...

How to get IIS application info via WMI

How would I get the actual directory path of an IIS application (virtual folder) using WMI? ...