wmi-query

WmiMonitorID - Converting the results to ASCII

陌路散爱 提交于 2021-02-19 04:18:44
问题 Am attempting to query the serial number and the model of the monitor. I managed to use the WMI code creator to generate the below code: Try Dim MInfo As New ManagementObjectSearcher("root\WMI", "SELECT * FROM WmiMonitorID") For Each Monitor In MInfo.Get() If Monitor("SerialNumberID") Is Nothing Then MsgBox("NA") Else Dim arrSerialNumberID As UInt16() arrSerialNumberID = Monitor("SerialNumberID") For Each arrValue As UInt16 In arrSerialNumberID Console.WriteLine("Serial: " & arrValue) Next

SMS_Application WMI class's equivalent table in SCCM database

北城余情 提交于 2021-02-11 14:02:29
问题 I'm having an AppModel application in my System Center Configuration Manager(SCCM) console. Please see below screenshot of the properties window of the SCCM application: I need to know the value of 'Allow this application to be installed from the Install Application task sequence.....' checkbox. It is highlighted in yellow. I tried to get it through wbemtest tool using below details: Namespace: root\sms\site_[siteCode] e.g. root\sms\site_lab Query: select * from SMS_Application I hope I've

How can I check if a specific process is running on a remote PC/Server?

好久不见. 提交于 2021-02-10 22:24:55
问题 string ComputerName = serverName; ManagementScope Scope; if (!ComputerName.Equals("localhost", StringComparison.OrdinalIgnoreCase)) { ConnectionOptions Conn = new ConnectionOptions(); Conn.Username = ""; Conn.Password = ""; Conn.Authority = "ntlmdomain:DOMAIN"; Scope = new ManagementScope(String.Format("\\\\{0}\\root\\CIMV2", ComputerName), Conn); } else Scope = new ManagementScope(String.Format("\\\\{0}\\root\\CIMV2", ComputerName), null); Scope.Connect(); // CRASH HERE ObjectQuery Query =

how to check service state using vbscript?

╄→尐↘猪︶ㄣ 提交于 2021-02-07 13:57:15
问题 Is there anyway to check the status of service using vbscript ? I would like to have a function for each possible service state : LINK Any help would be great. I did write a function for checking if service is stopped : Public Function IsServiceStop(ByVal serviceName) On Error Resume Next Dim objServices, service Set oWmiService = GetObject("winmgmts:\\.\root\cimv2") Set objServices = oWmiService.ExecQuery("Select * from Win32_Service where Name='" & serviceName & "'") For Each service In

Using Python and WMI Queries to get a list of running services

落爺英雄遲暮 提交于 2021-01-29 10:40:23
问题 I am attempting to get a list of services that are running on a windows machine with python. My Code: import wmi c = wmi.WMI() wql = "SELECT * FROM Win32_Service WHERE State = ""Running""" for x in c.query(wql): print(x) I am getting an error and I do not understand why. I have a few other wql statements in my script and they seem to be working fine. Error: Traceback (most recent call last): File "C:/Users/i861470/Desktop/Scripts/test.py", line 79, in <module> for x in c.query(wql): File "C:

Trouble with escape character in WMI query

Deadly 提交于 2021-01-27 21:15:59
问题 processName.Name = @"\\dfs\ns1\Application_Data\tiny\Development\tinyLOS\tinyLOS.exe"; string wmiQuery = string.Format("select CommandLine from Win32_Process where PathName='{0}'", processName.Name); ManagementObjectSearcher searcher = new ManagementObjectSearcher(wmiQuery); ManagementObjectCollection retObjectCollection = searcher.Get(); I am trying to run the above code in C# using WMI but i keep getting an invalid query error when it executes. I suspect it's a problem with escaping the

Cannot access Win32_WinSAT from 32 bits process

僤鯓⒐⒋嵵緔 提交于 2021-01-27 07:07:16
问题 When requesting Win32_WinSAT from a x64 process I get the correct results (WinSATAssessmentState = 1), but when executed from a x86 I get "results not available" (WinSATAssessmentState = 3) x64 Powershell: PS C:\Users\alive> gwmi Win32_WinSAT __GENUS : 2 __CLASS : Win32_WinSAT __SUPERCLASS : __DYNASTY : Win32_WinSAT __RELPATH : Win32_WinSAT.TimeTaken="MostRecentAssessment" __PROPERTY_COUNT : 8 __DERIVATION : {} __SERVER : COMPNAME __NAMESPACE : root\cimv2 __PATH : \\COMPNAME\root\cimv2:Win32

Cannot access Win32_WinSAT from 32 bits process

半腔热情 提交于 2021-01-27 07:05:15
问题 When requesting Win32_WinSAT from a x64 process I get the correct results (WinSATAssessmentState = 1), but when executed from a x86 I get "results not available" (WinSATAssessmentState = 3) x64 Powershell: PS C:\Users\alive> gwmi Win32_WinSAT __GENUS : 2 __CLASS : Win32_WinSAT __SUPERCLASS : __DYNASTY : Win32_WinSAT __RELPATH : Win32_WinSAT.TimeTaken="MostRecentAssessment" __PROPERTY_COUNT : 8 __DERIVATION : {} __SERVER : COMPNAME __NAMESPACE : root\cimv2 __PATH : \\COMPNAME\root\cimv2:Win32

Read Registry Values using Microsoft.Management.Infrastructure (CimSession)

跟風遠走 提交于 2020-12-13 03:25:26
问题 I am able to query WMI classes and registry values using System.Management and StdRegProv (for registry). I want to move over to using Microsoft.Management.Infrastructure instead of System.Management. So far With help from lot of articles on the net, I can do a CIMSession and get the WMI classes (e.g. Win32_OperatingSystem) etc. with code as below using Microsoft.Management.Infrastructure; ... string Namespace = @"root\cimv2"; string OSQuery = "SELECT * FROM Win32_OperatingSystem"; CimSession

Read Registry Values using Microsoft.Management.Infrastructure (CimSession)

青春壹個敷衍的年華 提交于 2020-12-13 03:23:22
问题 I am able to query WMI classes and registry values using System.Management and StdRegProv (for registry). I want to move over to using Microsoft.Management.Infrastructure instead of System.Management. So far With help from lot of articles on the net, I can do a CIMSession and get the WMI classes (e.g. Win32_OperatingSystem) etc. with code as below using Microsoft.Management.Infrastructure; ... string Namespace = @"root\cimv2"; string OSQuery = "SELECT * FROM Win32_OperatingSystem"; CimSession