wmi-query

Checking for equivalent shared folders in .net

Is there a way, within the .net framework, to check to see if two different shared folders are actually pointing to the same physical directory? Do directories in Windows have some sort of unique identifier? Google-fu is failing me. (I mean, aside from writing a temp file to one and seeing if it appears in the other) Edit: I think I'...

WMI Process Watching uses too much CPU! Any better method?

I need to watch when certain processes are started or stopped on a Windows machine. I'm currently tapped into the WMI system and querying it every 5 seconds, but this causes a CPU spike every 5 seconds because WMI is WMI. Is there a better way of doing this? I could just make a list of running processes and attach an Exited event to them...

WQL query for monitoring file change

Hi Guys, I need some help since I am new to WMI Events. I am trying to write WQL query for monitoring any changes that occure in a file that is placed in specific folder(C:\Data) I come up with the following query,but WMIEvent never occures. SELECT * FROM __InstanceModificationEvent WITHIN 1 WHERE TargetInstance ISA "CIM_DataFile" AND T...

Hyper-V/WMI programming Question

I've looked at several objects in the "root\virtualization" name space but I have not been able to find where Hyper-V stores the path to the config file for a given virtual machine. I need to get this file path programmatically or at least just the home path of a given virtual machine would be fine as well. What WMI object and field stor...

WMI Query to get list of Service Packs

Is it possible to find out the service packs that are installed on a Windows 2000 machine using WMI? ...

List of WMIEvent classes

Recently I have been learning about WMI and WQL. I found out the list of Win32 classes (from MSDN) that I can query for but I am not able to find out the list of event classes (should be the subset of the list of Win32 classes isn't it ?) Does any one have a list or some kind of cheat sheet for this? I am jsut asking this out of curiosit...

Why is this WMI query hanging on the second time it's called?

The following WMI query throws an exception at serverProtocolsManagement.Get() when sqlHost is an invalid server name (as expected. However, if I try to invoke this code again with the same invalid parameter, the ManagementScope constructor hangs indefinitely (never returns or throws an error, just hangs). Is there a reasonable explanati...

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 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)? ...

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...

What are some common WMI queries

I'm building a C# monitor app which uses WMI to grab some performance details of a remote computer. What are some good WMI queries to grab helpful stats such as CPU load, RAM usage, HDD free space, etc. For example, you can get the CPU load from the property "LoadPercentage" with the query "SELECT * FROM Win32_Processor". What are som...

Get Link Speed - Win32_PerfRawData_Tcpip_NetworkInterface

Hi, I found Determining the network connection link speed and now I am trying to correlate the data from Win32_PerfRawData_Tcpip_NetworkInterface with Win32_NetworkAdapter (or Win32_NetworkAdapterConfiguration). On the class Win32_PerfRawData_Tcpip_NetworkInterface I don't see any index or unique key that I can use to reference Win32_...

WMI query issue in PowerShell

Here is where I have started: #Get Physical Memory function getwmiinfo ($svr) { gwmi -query "select * from Win32_PhysicalMemory" -computername $svr | select [$svr], DeviceLocator } $Servers = get-content -path "C:\test.txt" foreach($Servers in $Servers) { getwmiinfo $Servers } I get this: [risk] Devic...

Access SQL - WMI Namespaces from Remote Machine

Hi, i am playing with Powershell and SQL WMI events and i am wondering if i can do this stuff remotely from the admin notebook: I'd like to query the "root\Microsoft\SqlServer\ServerEvents\MSSQLSERVER" namespace: On SQLServer directly: get-wmiobject -list -namespace "root\Microsoft\SqlServer" >> Works! get-wmiobject -list -namespac...

WMI querying issues in Python

I've recently been working on a Squish test script, and trying to do something like what's described in the solution at: http://stackoverflow.com/questions/938733/python-total-memory-used/938800#938800 The relevant snippets from my code are as follows: def measureMemory(): w = wmi.WMI('.') result = w.query("SELECT WorkingSet FR...

How can I test whether or not "Microsoft Windows 7 Home Premium" is the operating system using VBScript?

My first attempt is to query Win32_OperatingSystem for the caption, and test whether the caption "equals" the operating system I am testing for: Dim objWMIService, strComputer strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") msgbox getOperatingSystemCaption() msgbox meetsOperatingSystemRequi...

use wmi to get newest Windows log events

I want to use WMI to monitor the Windows event log and get newest log events every 15 minute. Although I can use WQL to do the query, it does not have the keywords such as order by. Any ideas how to work around this problem? ...

In WMI, can I use a join (or something similar) to acquire the IisWebServer object for a site, given server name and deployment location

Given a server name and a physical path, I'd like to be able to hunt down the IISWebServer object and ApplicationPool. Website url is also an acceptable input. Our technologies are IIS 6, WMI, and access via C# or Powershell 2. I'm certain this would be easier with IIS 7 its managed API. We don't have that yet. Here's what I can do: ...

Is there a way to query WMI without using PowerShell or CIM Studio?

I'd like to query WMI for WCF service information, but I'd rather not use PowerShell or the CIM Studio. Any other tools for doing this (command-line is cool too)? ...

WMIprvse process leaks memory on 2008 server R2

I have a Windows 2008 R2 server running on a VM machine. My .NET service is running on this server periodically querying WMI, for example: SELECT ProcessId FROM Win32_Service WHERE ... After a day or two WMIprvse takes up to 500M memory and WMI queries start getting out of memory exceptions. This article seems to be talking about thi...