Click here to Skip to main content
15,892,517 members
Everything / WMI

WMI

WMI

Great Reads

by Mark Kruger
Visual Studio loader with arguments
by Kai Schtrom
Win32_NetworkAdapterConfiguration WMI class in plain C and C++
by awilson9010
Working with Windows BCD store in Powershell
by Rene Pally
The purpose of this article is to show how to capture the WMI queries sent to the system in plain text using assembler and a powerful debugger.

Latest Articles

by Bruno van Dooren
How to clean up user profiles on a computer
by Kai Schtrom
Win32_NetworkAdapterConfiguration WMI class in plain C and C++
by awilson9010
Working with Windows BCD store in Powershell
by Mark Kruger
Visual Studio loader with arguments

All Articles

Sort by Score

WMI 

24 Oct 2018 by Mark Kruger
Visual Studio loader with arguments
18 Dec 2021 by Kai Schtrom
Win32_NetworkAdapterConfiguration WMI class in plain C and C++
1 Nov 2020 by awilson9010
Working with Windows BCD store in Powershell
28 Nov 2011 by Rene Pally
The purpose of this article is to show how to capture the WMI queries sent to the system in plain text using assembler and a powerful debugger.
16 May 2012 by Wendelius
Could you use either:- Win32_Battery class[^]- Win32_SystemEnclosure class[^] (ChassisTypes)
16 May 2012 by Jim Jos
Please check this link lot of suggestions are therehttp://stackoverflow.com/questions/1013354/how-to-check-the-machine-type-laptop-or-desktop[^]
27 Dec 2012 by DinoRondelly
Cassia is what you need, I used this for a similar project,Below is the link to download the source as well as information on how to use it.http://code.google.com/p/cassia/[^]one can also refer to...
18 Feb 2017 by Dave Kreskowiak
The problem is you have to use a WQL query to get at the object and that's what I used in my tests.The first example you provided works because, on the Win32_LogicalDisk class, the DeviceID property is a Key. See the documentation here[^].On the Win32_Volume class, DriveLetter is not a...
18 Mar 2024 by Dave Kreskowiak
Simple. Windows Security considers most command lines a security risk to be seen by normal users. No, there is nothing you can do about it. Normal users can see the command lines for processes they launch themselves, but not for System, Local...
3 Nov 2013 by Zoltán Zörgő
WMI for logging? Worst idea I ever heard. If WMI is what it means to me in Windows environment, Windows Management Instrumentation[^], than it is not meant for logging whatsoever kind. I am pretty sure sqlite is much better option. If logging is event logging and not data acquisition (like...
12 Apr 2016 by Jochen Arndt
Because you can connect to both IPs from the local network but not from the outside, it seems that the connection is blocked by a firewall (e.g. on a router / gateway). This will not occur when using VPN (the firewall let the VPN packets pass).If your firewall provides logs, you may check...
20 Apr 2016 by Dave Kreskowiak
Error code 2 is FILE NOT FOUND.You can find what those error codes are here[^].The path you built doesn't exist on the target machine.
31 Aug 2016 by Jochen Arndt
Hidden partitions are not mounted (no drive letter assigned) and can't be therefore accessed using any logical disk based Windows function.When using Win32_DiskPartition you should have access to the label by the Name property. That is the text shown by diskpart in the "Label" column.
16 Mar 2017 by Dave Kreskowiak
You have to run your web site under a different account, one specifically setup to run the site AND have enough admin permissions to make changes to the network configuration.The default ASP.NET account does not have permissions to make those changes.Other than that, it doesn't matter...
23 Sep 2011 by André Kraak
Perhaps you should turn it around.Develop a monitoring service for the machines that need monitoring and have it send the WMI parameters to a central machine which then processes the data.In this way the integrity of the systems will remain in tact and you also will have less trouble with...
5 Mar 2012 by E.F. Nijboer
The snapshots of a running OS might not be able to handle those changes. A snapshot that was taken when the virtual machine had 4 processors and are restored with 2 processors won't work probably. I think the settings of the VM aren't stored with the snapshot and therefor changing the...
21 Mar 2012 by fjdiewornncalwe
You may want to start with this article: Howto: (Almost) Everything In Active Directory via C#[^]
14 May 2012 by sjsteve33171
Ok turns out you would use the string to read a uint64 value. I ran wbemtest, queried my hard disk found the size value if you then edit the property it tells you the qualifier is "CIMTYPE CIM_STRING uint64".I put this to the test and queried the size using the string reader and got:Hard...
28 May 2012 by Sergey Alexandrovich Kryukov
You are right, it can be done with WMI. Please see:http://stackoverflow.com/questions/777548/how-do-i-determine-the-owner-of-a-process-in-c[^].—SA
30 May 2012 by Dave Kreskowiak
There's no such thing. Software is either installed or it isn't. "Authorization" is not something the machine keeps track of, so how are you going to determine what is and isn't "authorized"??
7 Jun 2012 by cotsjdixon
I have discovered that our legacy client side application (in VB6) was not calling CoInitialzeSecurity. In XP this was fine. In Windows 7 the security is obviously tighter and we must now call this from our client. The next challenge was getting the VB6 code to work.Here is the code that has...
9 Jun 2012 by Jefferson Daniel
Hello I'v done a few example codes in my Project using WMI to retrive certain information from variables such as (Win32_ComputerSystem) and so forth. Some area though have a variety of list. For example this would give me the name of the computer. Dim strComputer = "."Dim objWMIService...
14 Jun 2012 by Alan N
You can probably look it up yourself faster than I can type this in http://msdn.microsoft.com/en-us/library/aa394572(v=vs.85)[^] but if you're too busy try the LastBootUpTime property.Alan.
22 Jul 2012 by JF2015
Hi,try this code:private void button1_Click(object sender, EventArgs e){ MessageBox.Show(GetLastSystemShutdown().ToString());}public static DateTime GetLastSystemShutdown(){ string sKey = @"System\CurrentControlSet\Control\Windows"; Microsoft.Win32.RegistryKey key =...
30 Jul 2012 by Dave Kreskowiak
You might want to send them a little utility to dump the values found in those WMI properties. Your problem is that there is NOTHING that says those values must be populated by the manufacturer and after a motherboard replacement the values may not have been repopulated by the tech who replaced...
30 Jul 2012 by Bernhard Hiller
Also we experience problems with WMI from time to time. When you google for "WMI repair", you'll find lots of results, seems to be quite common.Also group policies may be used to change permissions on WMI access.
29 Nov 2012 by OriginalGriff
It's a "manufacturer specific string" which translates to English as: "They can put anything they like in there".Normally, it is upper case Alphanumeric only, with a few special characters (hyphen, slash, space are the normal ones).Are you sure you are retrieving it correctly? It is...
8 Feb 2013 by Dave Moss75
As a fairly new .net developer I am looking for some help with WMI in VB.net on the .net 4.0 framework.I will start with an overview of what I am trying to achieve. I have several windows services that I have written and I want to expose the work these services are doing to a management...
30 May 2013 by KarstenK
here is a sample. http://msdn.microsoft.com/en-us/library/windows/desktop/aa390423(v=vs.85).aspx[^]Try to get it running. The interesting difference ist: CoInitializeEx(0, COINIT_MULTITHREADED);
12 Nov 2013 by agent_kruger
use the below codeFileSystemWatcher watcher = new FileSystemWatcher() { Path = FilePath, Filter = "Refresh.txt" }; watcher.EnableRaisingEvents = true; watcher.Created += new...
25 Nov 2013 by Sergey Alexandrovich Kryukov
Please start here: http://msdn.microsoft.com/en-us/library/cc512238%28v=vs.85%29.aspx[^].—SA
27 Mar 2014 by barneyman
All the clues are there-2147217405 == 0x80041003 == WBEM_E_ACCESS_DENIEDAdditionally, while(pEnumerator) is always going to be true
22 Apr 2014 by SaahilPriya
Connect Systems using WMI Services, Remote as well as Local
5 Sep 2014 by Member 10020245
I seemingly resolved this using the information at:http://bytes.com/topic/visual-basic-net/answers/382910-cpu-temperature[^]this page described the use of a utility called "wbemtest.exe" that is a part of windows.This utility lets you test the WMI capability of the local machine.Just...
20 Nov 2014 by Praneet Nadkar
Hi,Check this link:How To: (Almost) Everything In WMI via C# Part 2: Processes[^]This may give you an idea :)
20 Nov 2014 by Mathew Soji
Check these linksHow To: (Almost) Everything In WMI via C# Part 2: Processes[^]Windows Management Instrumentation (WMI) Implementation[^]
20 Nov 2014 by User 59241
It depends entirely on what you mean by 'memory usage'.You can start by using Win32_OperatingSystem class: http://msdn.microsoft.com/en-us/library/aa394239(v=vs.85).aspx[^]Example here: http://www.blackwasp.co.uk/GetMemory.aspx[^]
13 Feb 2015 by Frankie-C
Please see this codeproject article.
13 Feb 2015 by Abhinav S
More links -MSI Factory & Passing Command Line Arguments to a Custom Action[^]Pass arguments to WIX\MSI setup[^]
19 Mar 2015 by Indukanth
Hai All,How can Start exe file on remote machine??
19 Mar 2015 by User 59241
Google will help:Create a Remote Process using WMI in C#[^]http://stackoverflow.com/questions/9033380/start-process-with-wmi-on-remote-machine-from-a-share-on-another-remote-machine[^]
19 Mar 2015 by Dave Kreskowiak
A word of warning. You can use WMI to start a process on a remote machine but you must have administrator permissions to that machine.Also, you can start a process that shows a user interface but the user logged into the machine will never see it. This is because this is considered a massive...
29 Sep 2015 by Dave Kreskowiak
One problem you're going to run into is that any C# app requires the .NET Framework to be installed on the machine before you can run the app. If the framework is not installed your code doesn't run.The only way you're going to "protect" the contents of the drive with a password is if all...
27 Dec 2015 by BCN-163
here is the right way to call Format use WMI. reference websites are as follow.How to format a RAW disk in windows by C++ | wreckor[^]blog.aaronballman.com/2011/07/calling-instance-methods-in-wmi/#comment-48687namespace Utility{ const WCHAR* GetFileSystemStr(eFileSystem...
7 Aug 2017 by Andreas Mertens
After a lot of sifting through solutions found online and trying them out, I found the following: Attaching a VHD To A VM Using The Hyper-V WMI V2 Namespace – Taylor Brown's Blog[^] It is written for PowerShell, but it shows exactly how to allocate the resources. The issue I see with the...
3 Nov 2017 by Dave Kreskowiak
Yeah, that code is not starting the process on the remote machine. It's starting the process on whatever machine this code is running on. The Process class, IIRC, will not launch a process on a remote machine. WMI would be better suited to this and you can launch NON-INTERACTIVE remote...
6 Aug 2018 by Patrice T
Quote: Some people are trying to by pass this by using vga cable and connecting it to a bigger monitor so that many people may view it together. I just want to stop this. It is hopeless. Just a second PC and a webcam an your protection is done. Other software can record the video you play if...
8 Aug 2018 by Richard MacCutchan
See Child Devices of the Display Adapter | Microsoft Docs[^]. As it states in the first paragraph, external devices are not included in the list of child monitors, so there is no easy way to get the answer. If you look at the following discussions you can see that it is far from easy to find out...
22 Aug 2018 by Jochen Arndt
The Win32\_SerialPort class | Microsoft Docs[^] lists only physical serial ports and not virtual ones provided by device drivers. One solution is to use the MSSerial_PortName class in the \root\WMI namespace. See also List of SerialPorts queried using WMI differs from devicemanager? - Stack...
25 May 2021 by JohnnyC
First you need to add an entry to the Registry for the log from the "Applications and Services Logs" that you want before you can access it using WMI. These newer logs are not listed in the Registry by default and WMI checks the registry for...
19 Dec 2021 by 0x01AA
ISensor supports a property SensorType SensorType which is defined in ISensor like this: public enum SensorType { Voltage, // V Current, // A Power, // W Clock, // MHz Temperature, // °C ...
9 Mar 2023 by Bruno van Dooren
How to clean up user profiles on a computer
17 Aug 2011 by anaidy0u
hi!i'm a newbie user of wmi, and i'm using it for my code project and i need to rename the current computer name, and i don't know where to start and what to do. can anyone do some coding for me.it'll be a big help.thanks lot!regards,anaidyou
17 Aug 2011 by RaviRanjanKr
You can use the Rename method to rename a computer.have a look there-MSDN-[Rename Method of the Win32_ComputerSystem Class][^]and Take a look at given links for more referencesProgrammatically renaming a computer using C#[^]
19 Sep 2011 by Duc Huy Nguyen
Hi everyone,I'm studying WMI with MS C# 2010 on .Net framework 4.0I want to use some classes in namespace System.Management or System.Management.Instrumentation, such as ManagementClass, ManagementObject, ManagementPath ... But I hardly find them. None of these classes is exist in my current...
19 Sep 2011 by OriginalGriff
Have you added a reference to the System.Management assembly (in System.Management.dll)?
19 Sep 2011 by Duc Huy Nguyen
Oh, but I have had "using system.management" already.How to do what you've said? Sr because I'm newbie in MS VS
22 Sep 2011 by Allgaeuer
Hi guys,i just got a huge problem with a WMI query about the connected USB sticks. I use a predefined class USBStorageDriveManager that receives the connected USB sticks by the following WMI query:ManagementObjectCollection ^ drives = (gcnew ManagementObjectSearcher("SELECT...
23 Sep 2011 by Satya182
I'm developing a big project to monitor a remote machine's performance parameters like CPU,Memory,Diskspace through C# WMI. I want to use the minimum possible credentials to connect the remote machines. Because I don't want to bother my client to ask for the super-user credentials. Its sure that...
12 Oct 2011 by @BangIndia
i use msdev ..i use wmi to create the subkey in registry..i use void CreateKey()method.But it create only the sub key..i want to create the Dword value.. how to create that in any language but using wmi..
17 Oct 2011 by nina4ever
I know this question has been asked several times before. I’m working on a web application, and I need to execute a batch file on a remote machine. I`v tried two approaches: psexec and WMI, and they worked, but both of them take a long time to acquire a connection to the remote machine (5-10...
18 Oct 2011 by nina4ever
my batch file (on the remote server) calls an application that extracts users information from AD and writes it to a .txt file...In my web application i used to following code to execute that batch file.ConnectionOptions options = new ConnectionOptions();options.Username =...
16 Nov 2011 by @BangIndia
hai.i Creating the wmi function to schedule the task.parameter i set as followsmethod.SetInParam(L"Command",chFileArgs); method.SetInParam(L"DaysOfMonth",65536); method.SetInParam(L"DaysOfWeek",8); method.SetInParam(L"StartTime",?????);how to set the...
16 Nov 2011 by RKnGl
http://www.epo...
30 Nov 2011 by Zachary.shupp
I am new to programming and i m working on a project to pull machine information remotly. I have been having issues with getting the machine name in the textbox i created work with the code. i m also having issues with the wmi part as well.My over all goal is to have on button click the text...
15 Dec 2011 by payne173
Can anybody please let me know whether v hav any api to retreive rsop data on a domain using c#
22 Dec 2011 by girirajshah
hi, I m Searching for source code or help for REMOTELY APPLICATION INSTALLER that is able to intall any software remotly over connected machine in LAN as its remotly installer i need to add silently features for installing any software by this application that remote machine doesn't know abt...
22 Dec 2011 by jerfypowell
Here is what I googled for SCCM and C#.I know its not exactly what you are looking for, but maybe it will lead you in the direction you want.http://social.technet.microsoft.com/Forums/en-US/configmgrsdk/thread/f4d23b91-4bc2-45ac-a943-391e28ff7a25/[^]SCCM is a Microsoft Product...
1 Jan 2012 by Joe Rozario
Hi Friends,i am facing a problem ,My codeManagementObject classInstance = new ManagementObject("root\\MicrosoftDNS", "MicrosoftDNS_Zone.ContainerName='lemlab.local',DnsServerName='lab-lem-dc-01.lemlab.local',Name='lemlab.local'", ...
19 Jan 2012 by Cool Cassis
You can use the GPRsop class which ships with GPMC/RSAT.Simply add a reference to the Microsoft.GroupPolicy.dll.Here's a link to MSDN:http://msdn.microsoft.com/en-us/library/microsoft.grouppolicy.gprsop_members(v=vs.85).aspx[^]Otherwise you must use the WMI root\RSOP...
26 Feb 2012 by Member 4746610
Hi,i am trying to write a service monitor tool like services.mscwhere can the attribute "log on as" be found using WMIthankserez
27 Feb 2012 by Dave Kreskowiak
Did you happen to read the documentation on the Win32_Service WMI class??Win32_Service[^]?? If you did, you would have found the StartName property.
5 Mar 2012 by Neserize
Hi,I'm trying to modify Hyper-V virtual machine setting with "ModifyVirtualSystemResources" method, it works fine.But when vm has snapshots, I get code "4096" and any changes to machine.Any ideas?
8 Mar 2012 by Chithra Annie Joseph
Hello, Is there a way to detect whether Hyper-V is installed or not in a remote machine using WMI query. Thanks
7 Mar 2012 by Abhinav S
Hyper-V WMI Introduction[^] should help you to detect Hyper V. The full set of classes is available here[^].
12 Mar 2012 by Chithra Annie Joseph
Hi , Thanks for your replay . But can I check the same in Win 7, Xp,Vista and 2003, as these OS support Hyper-V as guest OS.
21 Mar 2012 by Sergey Alexandrovich Kryukov
Quick answer, just to the essence of things: this information is stored transparently to the user:http://en.wikipedia.org/wiki/Transparency_%28human-computer_interaction%29[^].By the way, passwords in their original forms are not stored anywhere at all. That would be way too unsafe. Nobody...
24 Mar 2012 by Wes Aday
WMI tasks for files and folders change file or folder properties through WMI, including creating a share or renaming a file. If you want to copy a file or read and write a file, the easiest way is to use the Windows Script Host FileSystemObject rather than WMI. For other examples, see the Files...
24 Mar 2012 by Clifford Nelson
Look at PowerShell. In verion 2 there is apparently cross computer capabilities. Can also do WMI from Powershell.
27 Mar 2012 by Henning Dieterichs
Try this one[^].The second entry is even on codeproject (the first is yours...)!
14 May 2012 by Alan N
Aah, you need a reference to the documentation.Here you go http://msdn.microsoft.com/en-us/library/ms221627(v=vs.85)[^]Alan.
14 May 2012 by enhzflep
Hi there, looking at VARIANT structure[^] my guess would be ullValI.e sizeof(unsigned long long) = 8 (win7 32bit app)
14 May 2012 by sjsteve33171
Maybe i've done something wrong but i've done the following:Read UINT64:void WMIReader::ReadPropertyUINT64( WCHAR* PropertyName, char* ReturnBuffer ){ VARIANT pProperty; ClassObject->Get( PropertyName, 0, &pProperty, 0, 0 ); sprintf( ReturnBuffer, "%ld", pProperty.ulVal...
15 May 2012 by smartguy
My answer for UINT64 is: uValUINT64 means unsigned int** secPoint (i.e. point to *point)that is (2 ^ 2)(4, unsigned int) * (2 ^ 6) 64KB = 2 ^ 8So it is uVal.void WMIReader::ReadPropertyInt( WCHAR* PropertyName, char* ReturnBuffer ){ ... ... sprintf( ReturnBuffer, "%i",...
23 May 2012 by Aaron Manning
Well, found the problem. *sigh*My ip/netmask list that I was passing to the function contained a first IP of 10.0.1.0 ... oversight on my part since it's an invalid IP. BUT the EnableStatic() call took the parameters and returned an HRESULT of OK. It doesn't seem like the EnableStatic() will...
23 May 2012 by Sergey Chepurin
There is a PDF manual from Siemens Description of the DCOM Settings [^]. It is for COM OPC client-server communication on XP. Try to follow the procedure described in this manual, which, i guess, is still not much different for Windows 7 computers.Certainly your attempt with...
25 May 2012 by y_dev
Hi,I'm trying to monitor all the processes on a windows system with my windows forms application using WMI. I want to know which process' are system process, which are user process(like the username in taskmanager). This is quite googleable but i also need to know which are related to...
30 May 2012 by Sandeep Mewara
I am removing this one as you have provided more information at other place. Please dont repost. Follow at one place: How to get the unauthorized installed software's in our pc?[^]
31 May 2012 by vicky024
I am doing project on remote system information how to connect to the remote computer in workgroup and gather information like hardware and software such as operating-system etc by using the wmi in c#?
10 Jun 2012 by Jefferson Daniel
Hey Me. Here the solution if anybody else wanted to know. A little bit of time, and as always I figure it out on my own lol Sub GetRamInfo() Dim StrComputer = "." Dim objWMIService = GetObject("winmgmts:" & " _ {impersonationLevel=impersonate}!\\" & StrComputer &...
14 Jun 2012 by Suraj S Koneri
I am working on C# code to get the system up time of any remote machines with the following code. ConnectionOptions connOptions = new ConnectionOptions(); connOptions.Impersonation = ImpersonationLevel.Impersonate; connOptions.EnablePrivileges = true; ...
18 Jun 2012 by Suraj S Koneri
Alternate solution:Library needs to be inlcded is System.Management ConnectionOptions connOptions = new ConnectionOptions(); connOptions.Impersonation = ImpersonationLevel.Impersonate; connOptions.EnablePrivileges = true; ManagementScope...
11 Jul 2012 by ali64iust
hello dearsi write a program that is service.i want find who is active user (logged on user).i find some code that get current user, but when i run service.the program return system.Sincerely yours, A.Imani
11 Jul 2012 by barneyman
How to get the logged on user with WMI[^]
27 Jul 2012 by imrpk
I need the Following things in c#:-1. Last system OFF Date and Time From event Viewer. Event ID = 10782. Last System OFF mode i.e Proper shut down / un expected (improper Shut Down) Event ID = 60063. Total System Running duration. Total Up Time.All the above things are available...
29 Jul 2012 by sunder.tinwar
Hi Guys,I was just creating a small tool to execute shell commands on remote machine and get output and errors.I am running my application under all privileges.Example : I should be able to run dir /a on remote machine and get output and so on for other commands.I just browsed...
29 Jul 2012 by Zoltán Zörgő
Look here: Create a Remote Process using WMI in C#[^]
10 Aug 2012 by arshad alam
Hi , i am retrieving machine details using c# and wmi . i using following code to retrieve information: ManagementScope scope =new ManagementScope(@"\\"+strIPAddress+@"\root\cimv2"); SelectQuery query = new SelectQuery(); query.QueryString = "select * from...
10 Aug 2012 by arshad alam
is there any way in c# to know that how many time any software get installed on the particular computer . i can get installed software list by wmi query ; ManagementScope scope = new ManagementScope(@"\\" + strIPAddress + @"\root\cimv2"); SelectQuery query = new...