wmi

.NET, WMI - StdRegProv not found!

Hi. Doing ManagementObject obj = new ManagementObject(@"root\default:StdRegProv"); throws ArgumentOutOfRangeException as well as ManagementClass regClass = new ManagementClass(new ManagementPath("StdRegProv")); inParams= regClass.GetMethodParameters("GetStringValue"); //throws ManagementException "Not found" What the..???????????? ...

Changing the physical path of an IIS website on a remote machine via Powershell

Hi All, I'm currently working on a deployment script that will take my site, export it from svn, remove any testing files etc in it, minify the javascript/css, copy the code to a remote web server, and then switch the physical path of the existing site to the new directory. So far I have everything working except for switching the phys...

How does one start and stop services using WMI from .NET?

How would one go about using WMI to start, stop, and query services on the local computer from .NET code? (I'm using C#) I have found good and accurate answers for using the ServiceController class to do this, but I'd like to use WMI if I can. ...

How can I get an active UNC Path in DFS programatically

Given a DFS path how would I know what is the active path it is currently on programatically. For exmaple I have 2 Servers shares as "\\Server1\Folder\" and "\\Server2\Folder\" and it has DFS turned on so it can be accessed on "\\DFS_Server\Folder\", how would I know what is the active path currently "\\DFS_Server\Folder\" is on, whethe...

WMI Exception: "COM object that has been separated from its underlying RCW cannot be used"

I'm subscribing to a WMI event and receiving a "COM object that has been separated from its underlying RCW cannot be used" error when my application closes. This question has been asked before, but it is quite different from my circumstances. I am calling this code from my main thread: string strComputer = @"."; ManagementScope scope =...

Python: getting an object's “attribute/method/property” either as a parameter to a method or as a property.

In the WMI module (yeah, my boss wants me to program in Windows — but at least it’s not in COBOL), it seems that you can access a WMI value either by passing it’s name as a string parameter of a method, blabla=wmithingy().getvalue('nameOfValue') or as a property/method: blabla=wmithingy().nameOfValue() Am I dreaming, smoking bad w...

How to get CPU and RAM usage for each process in C# using WMI

How to get CPU and RAM usage for each process in C# using WMI ? I want to do something like windows Task Manager just simpler. Best regards. EDIT: OK, after some testing I found few isues: 1. Process class from System.Diagnostic has to many limitations when dealing with remote system 2. WMI to remote computer is very slow, about 15 s...

get the description from an WMI class using vbscript

Hi, i need to know how can get the descrption from an WMI class using vbscript. i just founs this example but is in C# // Gets the class description. try { // Gets the property qualifiers. ObjectGetOptions op = new ObjectGetOptions(null, System.TimeSpan.MaxValue, true); Management...

How to list all WMI event classes using VBScript?

Using VBScript, how can I list all WMI classes that represent events? Thanks in advance. ...

How to fetch registry path from EventArrivedEventArgs object

I try to watch the registry events via WMI. I use the below query to watch any events inside HKLM\softwares WqlEventQuery query = new WqlEventQuery( "SELECT * FROM RegistryTreeChangeEvent WHERE " + "(Hive = 'HKEY_LOCAL_MACHINE')" + "AND Rootpath = 'Software'" As expected...

unsecapp connections

Hi. I'm utilizing WMI on a remote machine using .NET's ManagementObject and similar classes. Everything works great. But I have a concern about my app opening too many unsecapp connections every time form starts. Connections are establish and not closed for a long time. What this app approximately does is subscribes to some remote even...

How i can get the types of the parameters of an method for a WMI class

How i can get the parameters types of an method for a WMI class using vbscript actually i'm using this script strComputer = "." strNameSpace = "root\cimv2" Set objServices = GetObject("winmgmts:root\cimv2") Set objShare = objServices.Get("Win32_Share") Set objInParam = objShare.Methods_("Create"). _ inParameters.Properties_ For E...

How to list all WMI classes having methods using VBScript?

Using VBScript, how can I list all WMI classes that have methods? Thanks in advance. ...

Windows hardware / device driver report / inventory

I'm trying to figure out, how to create a hardware inventory / report on Windows 7 including: All devices in / attached to a system. Driver / device information per device (Device Type, Manufacturer, Driver Version, Driver Date, Driver Provider, Driver Files, Hardware Ids) If the drivers is digitally signed (WHQL) / has a valid signat...

Monitoring Drives with WMI

I am trying to monitor drives a local PC. I am interested in two events: when the drive is connected (USB drive, CD-ROM, Network Drive, etc.) and disconnected. I wrote a quick proof of concept using the ManagementOperationObserver and it partially works. Right now (with the code below), I am getting all sort of events. I would like to ge...

Windows WMI recent hardware detection

WMI : I don't know how to detect these hardware : DDR3 memory ms online docs, memorytype lists only DDR2 http://msdn.microsoft.com/en-us/library/aa394347%28v=VS.85%29.aspx hard disk with SATA : it seems WMI reports IDE notebook integrated video camera Do you know about other tips / caveats using WMI and recent hardware ? Is there an...

How to determine if a network path is available or not (online or offline)?

Using .NET / C#, how to determine if a network path (e.g. \mymachine\myfolder) is available or not (online or offline)? Is there a way to be notified by WMI of such event? Thanks! ...

How to change Primary DNS Suffix of a computer in .NET?

Hi all, I'm working on an auto-configure app for new PC's. I managed to programatically set all the needed parameters, except Primary DNS Suffix of a computer (please remember that this is different from the network connection default DNS suffix). Any help? Update: Here's requested class for setting IP, Subnet, Gateway, and DNS of the...

PNPDeviceID Format

I'm working on developing a WMI query for my application. It needs to find the assigned virtual COM port for a given VID/PID. Using the WMI Code Creator I have found that... Namespace: root\CIMV2 Class: Win32_SerialPort Property: PNPDeviceID ...returns a value of USB\VID_10C4&PID_EA60\0001. This same value can be found by going to...

Using WQL to Limit Results on a String Match

I'm working on developing a WMI query for my application. It needs to find the assigned virtual COM port for a given VID/PID. My query currently looks like this: "SELECT DeviceID FROM Win32_SerialPort WHERE PNPDeviceID = \"USB\\VID_10C4&PID_EA60\\0001\"" Based on my research, it should return "COM8". However, I'm getting an empty s...