Query over the content of CIM repository on Windows Machines that uses WQL (Windows Management Instrumentation Query Language ).
Questions tagged [wmi-query]
545 questions
2
votes
1 answer
Find specific SCSI Controller with WMI Query to Msvm_ResourceAllocationSettingData
Utilizing the Common utilities for the virtualization samples (V2)
I created a class that queries Msvm_VirtualSystemSettingData -
public static ManagementObject GetVirtualMachineSettings(ManagementObject virtualMachine)
{
using…

cameracode
- 97
- 1
- 10
2
votes
1 answer
Is it possible to get Cluster -> Availability Group Instance Node Map via WMI?
I wish to enumerate all the instances within a SQL Server Always On Availability Group.
There is a Dynamic Management View within SQL Sever which provides this, but you need to be connected to a relevant instance to query this view.
Also, I can see…

Kram
- 4,099
- 4
- 39
- 60
2
votes
1 answer
Trouble with escape character in WMI query
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…

mbrem
- 91
- 1
- 9
2
votes
1 answer
In Powershell, how to retrieve existing policy settings (Win8.1/server 2012 r2 core)
Is it possible in Powershell (using Get-WmiObject or similar) to retrieve existing policy setting on local, single win 8.1 or server 2012 R2 core machine?
In SecPol the policy I want to retrieve the setting for is
"Local Policies" -> "User Rights…

lockarm
- 21
- 2
2
votes
1 answer
WMI method for returning sql server instances returns empty string
I'm trying to create a WMI method to return all server instances but the GetCorrectWmiNameSpace(); returns an empty string. I use sql server 2012, any idea why is it returning an empty string?
public bool EnumerateSQLInstances()
{
string…

Cosmin
- 152
- 3
- 18
2
votes
2 answers
Detect .Net Framework 3.5 or higher using VBS through WMI
I have created a script which detects installed .Net Framework installed through registry. The condition should specifically detect 3.5 or higher version and continue the process. However, using the registry it seems not possible. Every time there…

xka
- 53
- 4
- 11
2
votes
1 answer
Find ports used by Process ID
I'm using the WMI management object searcher to find a process running on a machine and return the Process ID of that process.
What I need to do next is to find what port the process is listening on.
Is there a way to do this with WMI within C#? I…

David C
- 664
- 1
- 8
- 21
2
votes
1 answer
WMI - 'Access Denied' exception thrown while reading IIS applications in remote domain machine
Below is my code to read IIS applications in a remote machine which in in domain using WMI.
var connOptions = new ConnectionOptions
{
Username = "USERNAME",
…

Yash
- 214
- 4
- 16
2
votes
2 answers
Local path from shared path: Powershell
How to find the local path of a shared path.
My shared path is \\somemachine\shared\scripts\testing
Its local path is D:\myshares\scripts\testing
Thanks!

Pradebban Raja
- 443
- 5
- 20
2
votes
3 answers
Get Printer Port Number in c#
I want to get my printer's port number in c#
I have tried using Win32_Printer and PrinterSettings
//Required namespaces
using System.Management;
using System.Drawing.Printing;
using System.Runtime.InteropServices;
using System.ComponentModel;
using…

Vinay Pratap Singh Bhadauria
- 9,829
- 3
- 28
- 49
2
votes
0 answers
HRESULT from WMI ExecQuery is always success despite bad query
I'm trying to use ExecQuery() from http://msdn.microsoft.com/en-us/library/aa392107%28v=vs.85%29.aspx in a program, but I'm having problems with errors. Specifically, if the WQL query is good, then everything works. The results are good, I can…

Kcaz
- 21
- 2
2
votes
1 answer
How to modify environment variables using WMI and JavaScript?
I need to access an environment variable and modify its value. I can access the variable using WQL ==>
wmi.ExecQuery("Select * from Win32_Environment Where name='Path' And UserName=''");
However, I am not sure how to modify and save the…

Ahsan
- 2,964
- 11
- 53
- 96
2
votes
0 answers
WMI dependent services to use WMI Query
I am using WMI query to get share folder:
public static List GetNetworkShareFoldersList(string serverName)
{
List shares = new List();
// do not use ConnectionOptions to get shares from local…

kombsh
- 387
- 2
- 3
- 14
2
votes
1 answer
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…

Precipitous
- 5,253
- 4
- 28
- 34
2
votes
3 answers
Powershell function throwing null exception
Okay, so I've read up on calling functions and passing parameters in powershell but maybe I'm not understanding something. I am calling a function and passing a couple parameters and everything works fine. It is variable defined within the function…

snoop
- 379
- 3
- 8
- 21