Questions tagged [wmi]

Windows Management Instrumentation (WMI) is an API for managing the Windows operating system on local or remote computers.

4365 questions
140
votes
6 answers

How to list all properties of a PowerShell WMI object

When I look at the Win32_ComputerSystem class, it shows loads of properties like Status, PowerManagementCapabilities, etc. However, when in PowerShell I do the below I only get back a couple: PS C:\Windows\System32\drivers> Get-WmiObject -Class…
lara400
  • 4,646
  • 13
  • 46
  • 66
112
votes
14 answers

Generating a unique machine id

I need to write a function that generates an id that is unique for a given machine running a Windows OS. Currently, I'm using WMI to query various hardware parameters and concatenate them together and hash them to derive the unique id. My question…
HS.
  • 15,442
  • 8
  • 42
  • 48
108
votes
2 answers

Creating a shadow copy using the "Backup" context in a PowerShell

I am in the process of writing a PowerShell script for backing up a Windows computer using rsync. To this end, I am attempting to use WMI from said script to create a non-persistent Shadow copy with writer participation (as is apparently recommended…
Julien Picalausa
  • 1,189
  • 1
  • 7
  • 3
76
votes
10 answers

Detecting USB drive insertion and removal using windows service and c#

Looking into possibility of making an USB distributed application that will autostart on insertion of an USB stick and shutdown when removing the stick Will use .Net and C#. Looking for suggestion how to approach this using C#? Update: Two possible…
Kb.
  • 7,240
  • 13
  • 56
  • 75
70
votes
9 answers

How can I get the CPU temperature?

I need to gather some system information for the application I'm developing. The memory available and the CPU load are easy to get using C#. Unfortunately, the CPU temperature it's not that easy. I have tried using WMI, but I couldn't get anything…
yeyeyerman
  • 7,751
  • 7
  • 43
  • 52
48
votes
14 answers

WMI "installed" query different from add/remove programs list?

Trying to use WMI to obtain a list of installed programs for Windows XP. Using wmic, I tried: wmic /output:c:\ProgramList.txt product get name,version and I get a listing of many of the installed programs, but after scrubbing this list against what…
romandas
  • 4,086
  • 7
  • 29
  • 33
48
votes
9 answers

Getting the Username from the HKEY_USERS values

Is there a way to connect between the values under HKEY_USERS to the actual username? I saw some similar questions, but most (if not all) talks about C# code, and my need is in VBScript.
modz0r
  • 1,022
  • 1
  • 10
  • 17
44
votes
2 answers

How to call a method with output parameters in PowerShell?

I'm working on a script to get started in PowerShell. I'm trying to convert a working VBScript script that enumerates mapped network drives on a remote Windows computer. One of the tasks is to use remote WMI to read the registry and find the process…
spoulson
  • 21,335
  • 15
  • 77
  • 102
34
votes
2 answers

Can I try to ping a website through a specific adapter?

I hope this isn't too basic a question. The title kind of asks it all. :-)
richb01
  • 1,097
  • 2
  • 13
  • 25
31
votes
11 answers

How to connect to a remote Windows machine to execute commands using python?

I am new to Python and I am trying to make a script that connects to a remote windows machine and execute commands there and test ports connectivity. Here is the code that I am writing but it is not working. Basically, I want to and it returns with…
zewOlF
  • 403
  • 3
  • 8
  • 13
30
votes
9 answers

"Extend my Windows desktop onto this monitor" programmatically

I would like to be able to set "Extend my Windows desktop onto this monitor" via code. A PowerShell script would be ideal. WMI seems the way forward but I have zero knowledge in WMI.
Zi Makki
  • 401
  • 1
  • 4
  • 6
30
votes
5 answers

How to solve '...is a 'type', which is not valid in the given context'? (C#)

The following code produces the error: Error : 'CERas.CERAS' is a 'type', which is not valid in the given context Why does this error occur? using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace…
Penguen
  • 16,836
  • 42
  • 130
  • 205
29
votes
3 answers

Changing the physical path of an IIS website on a remote machine via Powershell

I'm currently working on a deployment script that will take my site, export it from svn, remove any testing files etc in it, minify the javascript/css, copy the code to a remote web server, and then switch the physical path of the existing site to…
Ryan French
  • 1,245
  • 3
  • 19
  • 34
29
votes
3 answers

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.
Mark
  • 5,223
  • 11
  • 51
  • 81
29
votes
4 answers

Finding information about all serial devices connected through USB in C#

My project requires detection of a specific device when it is connected to USB. The only way I can identify this device is by its description/device name, not the com port. What I have found to perform the correct function is using a WMI query and…
sebo
  • 1,584
  • 4
  • 16
  • 19
1
2 3
99 100