wmi-query

Is the PNPDeviceID unique

允我心安 提交于 2019-12-18 09:15:13
问题 I wonder if the PNPDeviceID of an USB drive is unique (at least a charge of identic devices) and if the ID does not change. Thanks in advance. 回答1: As far as I know -- No. For example, "USBSTOR\DISK&VEN_LG&PROD_USB_DRIVE&REV_1100\AA04012700014149 &0 " - is a device id of a usb stick. For all such given usb sticks device id will be the same. But Windows adds an instance id of device (" &0 "), so it can distinguish them. If you plug two same usb sticks the device id of each of them will be

WMI - select from Win32_Product takes a long time

*爱你&永不变心* 提交于 2019-12-18 08:59:17
问题 I am enumerating installed applications using WMI, and this block is taking a relatively long time to complete no matter how I structure it. It takes 13 seconds in my environment every time. Is there a better (faster) way to check if a program is installed? (I'm using iTunes as an example program to check for) private static string Timestamp { get { return DateTime.Now.ToString("HH:mm:ss.ffff"); } } private static void LoadInstalledPrograms() { List<string> installedPrograms = new List<string

Alternative to Win32_Product?

杀马特。学长 韩版系。学妹 提交于 2019-12-17 17:00:32
问题 After playing around with querying Win32_Product to find a software version, I couldn't understand why the results were so dog-slow. As much as 15 times slower than querying Win32_service or Win32_process . So coming here to see if I'm missing something, I find that others have reported the same issue, and this article explains why. The most-often suggested alternative to finding installed software is querying a registry entry or three. That was going to be my first solution, except my

Monitor Drive. Using VB Script

僤鯓⒐⒋嵵緔 提交于 2019-12-17 14:55:39
问题 I want to monitor a drive for file changes, using VBScript. I have the below code. It works fine for InstanceCreationEvent and InstanceDeletionEvent . But InstanceModificationEvent is not happening. From googling I got to know we need to use CIM_DataFile instead of CIM_DirectoryContainsFile to monitor InstanceModificationEvent . I am not sure how to modify the code. Can anyone help. FYI: One script should monitor all the folders and subfolders in a drive. PS: Any suggestion to improve the

How to get all details from Installed Updates Window

风流意气都作罢 提交于 2019-12-14 03:54:07
问题 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... 回答1: Edit: To get all the updates (installed via Windows Update only, even for 3rd party) and then export the result to a text file, you can use below script: $session = [activator]::CreateInstance([type]::GetTypeFromProgID(“Microsoft.Update.Session”,$ComputerName)) $us = $session.CreateUpdateSearcher()

Execute a process in a remote machine using WMI

你离开我真会死。 提交于 2019-12-13 16:27:00
问题 I want to open process pon remote machine, this remote machine is inside local network. I try this command and in the remote machine nothing happen, this user that i connect with have administrators rights. Both machines running Windows 7 static void Main(string[] args) { try { //Assign the name of the process you want to kill on the remote machine string processName = "notepad.exe"; //Assign the user name and password of the account to ConnectionOptions object //which have administrative

Delete file on Remote Server Using WMI

自古美人都是妖i 提交于 2019-12-13 15:22:33
问题 I'm trying to delete an existing file on the remote server using WMI. Here's my code: string name = @"\\servername\\OCROut\\basketball.txt"; ConnectionOptions options = new ConnectionOptions(remoteServer, "username", "password", "ntlmdomain:domainName", ImpersonationLevel.Impersonate, AuthenticationLevel.Default, true, null, System.TimeSpan.MaxValue); ManagementScope scope = new ManagementScope("\\\\server\\root\\cimv2", options); scope.Connect(); var query = new ObjectQuery(string.Format(

How to get memory range used by a specific device with WMI (Windows Management Instrumentation)

别等时光非礼了梦想. 提交于 2019-12-13 07:23:01
问题 How can I get the resources used by a specific device (in particular, the memory range) of a specific device knowing it's name and/or DeviceID and/or the Pci bus number, Device number and function number? For example, I want to know what memory range an Intel AHCI Controller uses. With the query "SELECT * FROM Win32_IDEController WHERE Name LIKE\"%ahci%\"" I can get some info like the complete name, device id, and other informations. Then I thought that using the complete name or device id I

Windows API equivalent to “WMIC QFE Get”

旧时模样 提交于 2019-12-12 18:24:35
问题 I am a newbie in C++ and currently working to get Windows Hotfix/Patch information in C++ DLL. I have evaluated the following ways: By executing a sub process in C++ code and running wmic qfe get and read all the data. By using the C++ APIs to initialize COM, Connect to Wbem and execute select * from win32_quickfixengineering query. Apart from above two methods, Is there any direct Windows API that does all the job for me and gives the list of KB Info currently installed on the machine? 回答1:

wmi event active window/focus window

流过昼夜 提交于 2019-12-12 18:16:47
问题 Trying to trawl through the WMI/WQL MS Reference Data and the WMI Code Creator Event Classes, but can't find anything to indicate: A) If this is possible B) How to do it Ideally i'd like to be able to subscribe to WMI Events that are of the nature of the End User changing (UI) window (any Windows application). 回答1: You are using the wrong tool, there is not WMI classes or WMI events related to the UI of a windows application. instead you must use the Windows messages and the WinAPI. 来源: https