wmi-query

get-wmiobject sql join in powershell - trying to find physical memory vs. virtual memory of remote systems

get-wmiobject -query "Select TotalPhysicalMemory from Win32_LogicalMemoryConfiguration" -computer COMPUTERNAME >>output.csv get-wmiobject -query "Select TotalPageFileSpace from Win32_LogicalMemoryConfiguration" -computer COMPUTERNAME >>output.csv I am trying to complete this script with an output as such: Computer Physical Memo...

Error in running "select * from CIM_VideoControllerResolution" on windows server 2008

Hi, I cannot run following WMI query on Windows server 2008 64 bit select * from CIM_VideoControllerResolution tried verifying from WMI explorer plz hlp how can i run this query Abdul Khaliq ...

How can I retrieve a Windows Computer's SID using WMI?

I'm not looking for User SIDs. I'm looking for the computer SID, which active directory would use to uniquely identify the computer. I also don't want to query the active directory server, i want to query the computer itself. ...

WMI failed to catch bulk events from Active Directory.

Hi Everyone, I am monitoring AD objects with following WQL event query. This code is catching normal changes but failed to catch bulk changes. I am updating AD objects using powershell command and this code is not receiving all committed changes. ConnectionOptions connection = new ConnectionOptions (); connection . Usernam...

WMI error when connecting to IIS7

I am getting the same error described here: http://forums.iis.net/p/1033115/1700749.aspx I have a PowerShell cmdlet that tries to control our web application running on Windows Server 2008 SP2 and IIS 7. One of the first things it tries to do is try to connect to the remote machine using WMI. It does this using code like this: Conne...

USE WMI and WMQ to get Logical Disk and Partition Information from Win32_PnPEntity of SERVICE type USBSTOR

I am detecting when our proprietary USB device is attached to a PC. When we detect this, we get the related Win32_PnPEntity. We want to use this Win32_PnPEntity as a source of the following information: - USB Descriptor VID, PID, REV, Firmware Version. - Logical Disk Drive Volume and Partition information to get Drive Letter informatio...

How can I add programatically service dependencies to an installed Window service ?

How can I add programatically service dependencies to an installed Window service ? It would really helpful, If someone suggest solution using WMI through the System.Management namespace . What is property for dependencies on which I can set services? ...

Java accessing WMI as a particular user.

Hello, I am trying to write a Java application that will query the WMI on windows hosts within domains to obtain their mac address and dns name. I can run the script via exec or using a few of the jars I have found on the internet but none that I have seen allow me to impersonate an AD account when I run the query. I would like to be a...

using WMI to uninstall applications remotely

Hi, I am trying to write a mini w32 executable to remotely uninstall an application using WMI. I can list all the installed applications using this code below but i couldnt find a way to uninstall the application remotely thru WMI and C# I know I can do same using msiexec as a process but I wish to solve this using WMI if its possibl...

Finding processor usage through WMI.

I am trying to use the Win32_PerfRawData_PerfOS_Processor class on a windows server enterprise 2007 remotely to find the CPU usage. But I am getting huge 14-15 digit values like 11745679223456 %. Any idea why it is giving erroneous result? It seems to work fine on my server 2008. Is there any way I can reinstall these classes? P.S : I d...

WMI Query for list of hotfixes installed in a system?

I am writing a perl script that will list the hotfixes installed in my system and check if any pre-requisite hotfixes are not available before beginning my program; So I need to be able to enumerate the list of hotfixes in the system; Here there is a mention of using wmic to generate a html file. Is it possible to do this via a WMI quer...

WinApi Base Services tutorial?

I need to make application which gathers basic data about system, like OS version, processor & memory type, data about installed programs... Application will be written in c and will work on Win Server 2000 and 2003. So first thing on my mind was WinApi, but i can not find any tutorials for these things, every tutorial i found is about U...

how to check group membership of an "NT AUTHORITY\" account ?

[1] informs: Local System account. The name of this account is NT AUTHORITY\System. It is a powerful account that has unrestricted access to all local system resources. It is a member of the Windows Administrators group on the local computer How to determine/check membership of "NT AUTHORITY\" account, such as NT AUTHORITY\SY...

Conversion of PerfRawData Values into Performatted data -WMI

I need to convert PagesPersec value from Win32_PerfRawData_PerfOS_Memory to PerfFormatted Data value .How to convert PerfRaw data values from WMI Perfomance counters to PerfFormatted Data values .Is there Standard Formula available recommended by Windows. ...

Query WMI remotely with PHP

My current code looks like this: define ( 'CPU_NAME', 'remote_server' ); $obj = new COM ( 'winmgmts:{impersonationLevel=impersonate}//' . CPU_NAME . '/root/cimv2' ); if ( is_object ( $obj ) ){ $process = $obj->execquery ( "SELECT * FROM Win32_Process" ); } Where would I put the login credentials for the remote_server? I see that...

Reliably get Latest Event Log Record with WQL

Hi All, I have written an application which collects windows logs from linux, via the Zenoss wmi-client package. It uses WQL to query the Event log and parses the return. My problem is trying to find the latest entry in the log. I stumbled across this which tells me to use the NumberOfRecords column in a query such as this Select ...

C# .NET ManagementObjectSearcher Query

My C# .NET 2.0 application performs two queries using the ManagementObjectSearcher class: _searcher = new ManagementObjectSearcher("root\\WMI", "SELECT * FROM MSWmi_PnPInstanceNames"); _searcher = new ManagementObjectSearcher("root\\WMI", "SELECT * FROM MSSerial_PortName"); I would like to combine them, so that _searcher contains all...

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

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