wmi

Out of memory exception while registering to a WMI event query

Short: What could cause an out-of-memory error when registering a WQL event query (error code 0x80041006)? How can we investigate the cause? Long: We keep getting an out-of-memory exception when trying to register a specific WQL event query in the MicrosoftDNS provider in a windows 2003 R2 server. We can reproduce by registering the f...

WMI vs Windows APIs

There are any advantages or disadvantages of using the WMI instead of Windows API to access to the information of the system? as speed, additional permissions, memory usage. or depends on the WMI class and how the WMI implements the access to the information? ...

Windows Script Host Error

I have the following code: Function ExistShare(strServer, strUser) Set objWMILocator = CreateObject("WbemScripting.SWbemLocator") Set objWMIService = objWMILocator.ConnectServer (strServer, "root\cimv2", "NSWIDCFPT03\WMIQuerys", "XXXPASSWORDXXX") objWMIService.Security_.ImpersonationLevel = 3 'Set colShares = objWMIServi...

How can I access 64 bit registry hive information from a application running in 32 bit mode on a 64 bit machine(WOW) using WMI through C#

I think the question really sums up what i'm trying to do. Here is the code that i'm using. It works in every scenario except if my application is running in 32 bit mode on a 64 bit machine. No matter how I play arround with the __ProviderArchitecture and __RequiredArchitecture flags, i can always only seem to access the 32 bit section o...

Change the settings of a single NIC using WMI (C#)?

Hi. I have read this article about using WMI to change the settings of NICs ( Article) But I can't figure out how to change the settings of a single NIC (based on MACaddress, ID or whatever) instead of all NICs !? Anyone ? ...

IOWriteBytesPersec is actually total bytes?

The documentation for the Windows WMI counter Win32_PerfRawData_PerfProc_Process.IOWriteBytesPersec says it's number of bytes per second, but it behaves like a total. For example, the same data is viewable in task manager as "I/O Write Bytes" but the value only ever seems to go up, never down. The same goes for read byte...

WMI Class for wireless mouse

What is the WMI class to get information about Wireless mouse? EDIT: How do I distinguish USB mouse from Wireless mouse(Connected via USB Doggle). DeviceInterface value from Win32_PointingDevice class shows as 162 for both because both are connected via USB. But I want to distinguish between these mouses. ...

WMI Error in Windows Server 2008 (WMI Provider)

Hi, I've implemented a WMI provider (Window service, Instance, Methods and Properties provider). It works fine on Windows Server 2003, but when it run on Windows Server 2008 with non-local administrator user, I cannot query it. The error I get is 0x8004101d - unexpected error. When the service user is a local admin everything is OK. Wh...

Can't read from RSOP_RegistryPolicySetting WMI class in root\RSOP namespace

The class is documented in http://msdn.microsoft.com/en-us/library/aa375050%28VS.85%29.aspx And from this page it seems it's not an abstract class: http://msdn.microsoft.com/en-us/library/aa375084%28VS.85%29.aspx But whenever I run the code below I get an "Invalid Class" exception in ManagementObjectSearcher.Get(). So, does this clas...

Is there any way to read password policies via the WMI RSOP_XXX classes?

Those all reside in the root\RSOP\Computer namespace. The only class from which I got non-empty results is RSOP_RegistryPolicySetting, and that one only gave me settings for Windows Update and System Restore configuration. I do know there are password policies in our network (age, length etc), but queries on the following classes only g...

Closing Open Files using C#

I have a situation where people are connected to files on a share and it's blocking me from overwriting the file. I'm trying to write a method that will look to see if a filePath that I provide is currently locked in this way and close the network session of this resource. I looked at the ADSI Winnt provider but the Resources.Remove mem...

WMI: How to differentiate between Wireless mouse and touch screen

I am using Win32_PointingDevice class to detect mice connected to the system. I ran my device discovery script on a machine which has touch screen. The discovery shows up with 3 pointing devices, directly connected USB mouse, wireless mouse and touch screen. My question is how to distinguish between USB mouse with touch screen. If Win3...

WMI Poor Performace

Hi I wrote a code in C# that maps logical drives to their physical disks, using WMI (System.Management). The code working perfectly, but slow like hell. In my machine (Windows 7 x64, Dual-Core with 3 GB RAM) it runs as least 1 second. 1 second is too slow for me, even 0.1 is more than enough to accomplish. I more than sore that this fun...

How can I query NTFS disk quotas in C#?

I need to be able to find, for all users on a given remote machine, those users' disk quotas and actual disk usage. I need to be able to do this reporting in a C# application. (Well, technically a DLL plugin for an app I've already built; but that's irrelevant here.) The remote machine is not on the same network, however, the applicati...

Starting application pools with WMI\ADSI (C#) hangs immediately after reboot

Hi, I have encountered a strange situation where starting an application pool from a windows service (written in C#, set to "Automatic" startup) using WMI or ADSI immediately after the server reboots hangs. I'll describe the issue: We are developing a large application (Windows 2003 Server SP2, IIS 6.0) which contains the following...

Python Windows Service Problems - Works when using debug argument but not while started as a service?

Hello all, hopefully someone here can shed some light on my issue :D I've been creating a Windows XP service in python that is designed to monitor/repair selected Windows/Application/Service settings, atm I have been focusing on default DCOM settings. The idea is to backup our default configuration within another registry key for refer...

deviceID format for PS/2 mouse

I would like to know the DeviceID and PNPDeviceID format for PS/2 Mouse. On my system Device ID for PS/2 mouse is ACPI\PNP0F13\4&1F1D307&0. So is the format is ACPI\PNPxxxx{something} or some thing else? I mean is ACPI is mandatory for PS/2 mouse? ...

Determine Users Accessing a Shared Folder Using PowerShell

Hi, I need to determine the users/sessions accessing a shared folder on a Windows XP (SP2) machine using a PowerShell script (v 1.0). This is the information displayed using Computer Management | System Tools | Shared Folders | Sessions. Can anyone give me pointers on how to go about this? I'm guessing it will require a WMI query, bu...

Programmatically differentiating between USB Floppy Drive and USB Flash Drive in Windows

On Windows (XP-7), is there a reliable way of programatically differentiating between USB floppy drives and USB flash drives in C++? At the moment, I'm using WMI to get updates when new Win32_LogicalDisk instances are detected, and then using the DriveType attribute of the LogicalDisk object to figure out a basic type. This works quite ...

Check for daylight saving time with WMI on Vista/Win7

How do I find out if the computer I'm on has daylight saving time in effect? (preferably using WMI) According to this article at TechNet, I could query SELECT DaylightInEffect FROM Win32_ComputerSystem, but the property DaylightInEffect is not supported on Vista or Win7. As my program will run on various systems (XP, Vista, 7), I would ...