wmi

Returning mounted drives on server in WQL

I am trying create a simple WQL query where I only return mounted drives on a server. These are drives that do not have a drive letter associated with them. I tried the following sytnax and it does not return a result set: SELECT * FROM Win32_Volume WHERE DriveLetter = "" Here is the complete code sample in C#: string ManagementPat...

Add DNS records from .NET app

I am working on a webapp that we acquired from another company. When you "sign up", the server is supposed to create a DNS alias using WMI. It was crashing with a "Generic Error", which was later cured by adding the following tag to the Web.config file: identity impersonate="true" userName="administrator" password="theadminpass" This w...

How to get webcam info with WMI

Which class that we can obtain webcam info? Thank ...

SCardListReaders reader name and the WMI Win32_PnPEntity reader name - find a match

TLDR Version: The SCardListReaders function from winscard.dll may return the reader name like "SCM Microsystems Inc. SCR331-DI USB ContactlessReader 0". The WMI Win32_PnPEntity may have a name like "USB Contactless Reader". Is there a way to identify programmatically that this is the same device? Long Version: The SCardListReaders fun...

Access Motherboard information without using WMI

I need to access motheroard identification (serial, manufacture, etc) in my application on multiple processes. I have been able to successfully query this using WMI, but I'm looking for an alternative. If you care to know situation: I have some application behavior that is different depending on the hardware configuration, or if a par...

WMI EnableDHCP fails on disconnected adapter

I'm using the WMI Win32_NetworkAdapterConfiguration Class EnableDHCP Method to enable the DHCP service on a network adapter. I'm using XP Embedded with SP2 but it also happens on my desktop (XP SP3). Everything works great except when the network cable is unplugged. If the cable is disconnected, EnableDHCP returns 94 (Path, file, or o...

Finding out whether a pathspec is a directory or file (or something else) through WMI?

I have some C# code to get information about a file through WMI, which used to make the following query: SELECT * FROM CIM_DataFile WHERE Drive = 'C:' AND Path = '\\temp\\' AND FileName = 'testemef' AND Extension = 'txt' I found out I can query both directories and files if I use the CIM_LogicalFile class instead: SELECT * FROM CIM_L...

Remote Shutdown without (!) RPC Service

There are different ways of shutting down a computer remotely. Here are three I know of: Invoking the Shutdown method of the Win32_OperatingSystem class through a remote WMI connection Using the Microsoft Windows shutdown.exe Letting your (whatever).exe copy itself to the systemfolder on the target machine, register itself as a servic...

With WMI: How can I get the name of the user account who's running my program?

I need to restrict access to my application to only one specific user account. I have found classes under WMI to find users accounts but I don´t know how to recognize wich one is running my app. Thanks in advance for your anserws. ...

WMI Win32_BaseBoard SerialNumber

I used Win32_BaseBoard SerialNumber property to obtain the motherboard serial number and it work most of the time, but sometimes in some computers I get SerialNumber = "Base Board Serial Number" as a result. Is there a programmatic way to obtain this serial number in a more efficient way or it is simply a manufacturer problem? I have he...

How restrict an application to run only from a known USB flash drive?

I need an application to run only from a specific USB flash drive. I made some test with the WMI Win32_Diskdrive class and the PNPdeviceID property. It is a very good idea to enroll the application into a license server (web services) with this data, but I'm searching for a second method to reenforce this one in order to make the process...

How sure is to create a USB security key using PnPDeviveID?

I need to protect software using a USB key. Can I just query a USB drive with WMI and obtain the PnPDeviceId from Win32_DiskDrive Class, and compare it with one already hashed and hard coded in the application? How secure is this? Can the PNPDeviceID property be modified? Is hardware coded? Any other idea? Logically the USB drives are g...

Determine 3rd Party Application Installation Directory

I have an application that is used on several hundred computers across the company that I must modify an INI file in the installation directory of the application. Users can install the application where ever they wish, and can have multiple versions of the application installed at any given time. I need to be able to find that installat...

Set Fan Speed on Windows in C++

I have this copied code from Example: Calling a Provider Method, it modified it now should it change CPU fan speed: #define _WIN32_DCOM #include <iostream> using namespace std; #include <comdef.h> #include <Wbemidl.h> # pragma comment(lib, "wbemuuid.lib") int main(int iArgCnt, char ** argv) { if(IsDebuggerPresent())cout<<"Debugee...

Using PerformanceCounter through an ASP.NET AJAX call

In our office we have a 40" LCD mounted to the wall that runs a full screen instance of Firefox that in turn hosts a series of modules. Each of these modules is a self contained DIV with an AJAX interface (through jQuery) to the server to perform it's function. One of these modules monitors our servers CPU, memory and disk usage. On th...

Use PowerShell to enumerate Linux SMB shares

I can list my own computer's shares no problem with: gwmi Win32_Share But when I try gwmi Win32_Share -computer myserver Where myserver is an HP MediaVault mv2120 running BusyBox. I get back the response: Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA) Is there any way to get this done? ...

Can't locate Flash Player in WMI win32_product table

How come the Macromedia Flash Player isn't present in the WMI win32_product table? The Flash Player is installed on the machine where I'm executing the query. I'm trying to execute the following query: Select * From win32_product where name like '%Flash%' Is there any other way to get the version of any installed Flash Player. This p...

How to use VB.NET to query remote server event logs?

I am working on creating a web app that will query event logs on internal servers for events using a specific ID. Since most of the servers are running Windows Server 2003, I cannot use the preferred System.Diagnostics.Eventing.Reader method that I was hoping to use. I've seen the mention of using WMI, but would like to avoid this if p...

Win32_DiskDrive Signature property

Does anybody know what is the Signature property of the Win32_DiskDrive WMI class? Is it unique or users can change it like disk volume serial number? Thanks. ...

Book Recommendation: Writing WMI Provider Extensions using .NET 3.5

I'm looking for an in-depth guide on writing WMI Provider Exensions using .NET 3.5. I've spent some time searching, but so far I haven't found anything that meets this description. Is there such a book? I would prefer one that uses C#, but I'm not sure I can afford to be picky in this case. ...