Questions tagged [wmi-query]

Query over the content of CIM repository on Windows Machines that uses WQL (Windows Management Instrumentation Query Language ).

545 questions
2
votes
1 answer

List all physical printers using WMI query in Inno Setup

I'm trying to get the list of physical printer's name, that are connected to Windows, based on an answer from Query available RAM in Inno Setup. But just get: "Send To OneNote 16". Here is my query: Query := 'SELECT Name FROM Win32_Printer'; Printer…
2
votes
0 answers

How to get all logical disks associated only with exact hard drive using WMI?

In example, I have an index of physical drive, and I want to get all logical drives on it, so I try this: var searcher2 = new ManagementObjectSearcher(string.Format("ASSOCIATORS OF {{Win32_DiskDrive.DeviceID='\\\\.\\PHYSICALDRIVE{0}'}} WHERE…
makujin
  • 21
  • 1
2
votes
1 answer

How to retrieve PID from windows event log?

I have a python code that uses WMI module of python to get windows event viewer logs. But I am unable to retrieve the PID of the process that generated the log. My code : wmi_obj = wmi.WMI('.') #Initialize WMI object and query. wmi_query = "SELECT *…
Umang Agrawal
  • 475
  • 1
  • 5
  • 15
2
votes
1 answer

WMIC syntax to delete a printer Not Like

I need a wmic script to delete all printers where the DeviceID Not Like '%%KM%%' The following syntax works to delete where like printer where "DeviceID LIKE '%%KM%%'" delete when I change to printer where "DeviceID NOT LIKE '%%KM%%'" delete I…
FWool
  • 21
  • 1
  • 3
2
votes
1 answer

Lookup release date for any given Windows Update with Powershell

We have SCCM 2012 R2 installed in our environment, I can execute a WMI query to get information about patches on a given computer like this: $updates = Get-WmiObject -Class CCM_UpdateStatus -Namespace ROOT\ccm\SoftwareUpdates\UpdatesStore…
Brian McMahon
  • 369
  • 3
  • 12
2
votes
2 answers

Reliably get Latest Event Log Record with WQL

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…
Greg Olmstead
  • 1,551
  • 10
  • 22
2
votes
3 answers

Get CPU usage for each core using the windows command line

Is it possible to print the current CPU usage for each core in the system? This is what I have so far using powershell: Get-WmiObject -Query "select Name, PercentProcessorTime from Win32_PerfFormattedData_PerfOS_Processor"
Fidel
  • 7,027
  • 11
  • 57
  • 81
2
votes
4 answers

How to get all details from Installed Updates Window

I want to get all of this information (including non-windows updates) in any text format... Please share if you have any way to fetch these infos. For more details please see attached image...
Jay Panchal
  • 75
  • 1
  • 2
  • 11
2
votes
1 answer

Get only IPV4 Addres and Exclude IPv6 from WMI PHP

I Have Script to get IP Address based on PHP and WMI like this: Get Active Adapter Network function get_server_network_adapter() { $pc = "."; $obj = new COM ("winmgmts:\\\\".$pc."\\root\\cimv2"); $wmi_network_rec =…
Dekz
  • 21
  • 3
2
votes
1 answer

WMI query to find CPU usage for each core

Is there a WMI/Power-shell query for finding out CPU usage for each different core. I had used "select LoadPercentage from Win32_Processor", but it gives only one value , say 65. But I wish to have Four different values, if My PC have four cores. It…
Sebastian Xavier
  • 2,499
  • 7
  • 27
  • 41
2
votes
1 answer

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…
Rajesh
  • 6,269
  • 5
  • 28
  • 23
2
votes
1 answer

WMI total session count from server

SELECT TotalSessions FROM Win32_TerminalService This count is always off by 1. If there is 1 user visible on the server, the count shows 2. This is from the MSDN TotalSessions Data type: uint32 Access type: Read-only The total number…
Tsukasa
  • 6,342
  • 16
  • 64
  • 96
2
votes
1 answer

ApplySnapshot Example Hyper-V V2

I am trying to apply a snapshot to a hyper V virtual machine using C# and using the ApplySnapshot Method. ApplySnapshot method But I seem to be struggling as there no sample class for that method. I would be gratefull if someone could help in…
BillyDay
  • 37
  • 1
  • 4
  • 14
2
votes
1 answer

WQL for enumerating all classes in a namespace

I am able to use the following query successfully on WMI, but I am unable to make it more granular using the __genus property. Works: select * from meta_class where __class like "%win32%" Works: select * from meta_class where __class like "%win32%"…
2
votes
0 answers

Windows - Unable to find WMI WiFi_AdapterAssociationInfo class

I am trying to execute the example at https://theroadtodelphi.wordpress.com/2011/10/15/all-about-wifi-networks-and-wifi-adapters-using-the-wmi-and-delphi/ in visual C++, wherein: the WMI class WiFi_AdapterAssociationInfo is queried retrieve WiFi…