wmi

How can I get local IP in .NET?

I have the following vbscript code that returns the local IP address. It works great. I am trying to provide the same functionality in my winform .net app. All the solutions I have come across involve using DNS. Any ideas on how to "port" this script for use in .net? A different way to do this maybe? Thanks! Function GetIP() Dim...

How to run execute .appref-ms C#

Hi I am trying to launch .appref-ms (Click once) application on remote machine using WMI but could not get success. The below code works fine if i try to run notpad.exe ManagementPath pm = new ManagementPath(@"\server\root\cimv2:Win32_process"); ManagementClass processClass = new ManagementClass(pm); //Get an input...

How to make forward-only, read-only WMI queries in C#?

I've been told by a coworker that if my WMI system information gathering queries are forward-only and/or read-only, they'll be quite faster. That makes sense. But how do I do it? ...

WMI Query to get list of Service Packs

Is it possible to find out the service packs that are installed on a Windows 2000 machine using WMI? ...

Is it possible to Shut down a local pc with group policies programatically through .net application?

I have a local application running with an user than have a group policy indicating this user can’t shutdown the pc. And then I use your code, but when I ask by user and password to impersonate my app. I received the next error System.Management.ManagementException: it’s not possible to use the user’s credentials for the local connecti...

Powershell - calling remote WMI objects - RPC error HRESULT: 0x800706BA (RPC server not available)

Hello, I've got some troubles with Get-WmiObject and usage of this object. In case, I'm connecting to remote computer - which is not in AD, but in the internet. I'm using credentials and I'm able to retrieve list of WMI classes, or object (to be specific, I want to work with Win32_Process) via commands: $credential = Get-Credential $...

Detecting AC Power connection in WinPE?

I'm trying to determine if a laptop is connected to AC power. The OS Im running under is WinPE. My app is written in native C++. WMI queries using Win32_Battery are not supported and the GetSystemPowerStatus API always returns '1' for ACLineStatus (running on AC power or not). Any ideas? Additonal investigation: Just tried the API '...

The Mono .NET framework and WMI

We have a .NET project that uses WMI and are interested in porting it to the Mono framework. It appears Mono does not support WMI. Are there any libraries that can add WMI support? Basically we would want to access a Windows server using WMI from a Linux/OS X box. ...

How to check the machine type? laptop or desktop?

How to check current machine type? laptop or desktop ? I got this from http://blog.csdn.net/antimatterworld/archive/2007/11/11/1878710.aspx ,it works well on my home machine(Win2003 on laptop), it returns "Portable", but failed on my work machine(Vista on laptop), it returns "Other". here is the code: public enum ChassisTypes { O...

Detect if the contents of a folder have changed?

Conditions: Windows 98 SE WMI not available I have code that looks like this, written using my steroidal wrapping of VBScript using MSScript. do a = files.collectfiles( "c:\userver", "" ) for i = 0 to ubound( a ) f = a(i) if strings.endswith( f, ".usv" ) then d = files.readfilee( f ) on error resume next executeglobal...

Convert .Net ManagementBaseObject to ManagementObject

I am trying to use the following code to write out all processes started on a computer. My problem is that the EventArrived method is passed a EventArrivedEventArgs which has a NewEvent property of type ManagementBaseObject. This does not have a InvokeMethod method. Can I convert the NewEvent property to a ManagementObject some how, o...

How to enumerate the domain wide policy setting for a specific group policy object in AD using WMI or powershell?

I would like to query the domain wide settings of a specific group policy object. How do I do that in Powershell or WMI? For instance I would like to know the value for the password policy setting 'Minimum password length' that is configured in the GPO for the entire domain. ...

How to / Is it possible to monitor remote WMI scripting???

Hello everybody, do u know perhaps a way (via script or program) to find out if e.g. a WMI script runs from a remote PC1 and performs some tasks in another PC2 when I am seating in a third PC: PC3 Assume that all PC belong to the same network and domain and have windows xp installed. The reason for this that I administer a small netwo...

List of WMIEvent classes

Recently I have been learning about WMI and WQL. I found out the list of Win32 classes (from MSDN) that I can query for but I am not able to find out the list of event classes (should be the subset of the list of Win32 classes isn't it ?) Does any one have a list or some kind of cheat sheet for this? I am jsut asking this out of curiosit...

Memory leak using WMI in Delphi 7

I'm experiencing a memory leak when using WMI from Delphi 7 to query a (remote) pc. The memory leak only occurs on Windows 2003 (and Windows XP 64). Windows 2000 is fine, and so is Windows 2008. I'm wondering if anyone has experienced a similar problem. The fact that the leak only occurs in certain versions of Windows implies that it mi...

How can I improve WMI performance in .NET?

I've inherited code that makes numerous remote WMI calls. When I repeatedly pause execution and look at the call-stack it's almost always in a ManagementScope.Connect() call. A new connection seems to be made with each WQL query. Despite limited trial and error, I haven't found any big wins yet in improving the performance of the WMI ...

Inconsistency in WMI Win32_NetworkAdapter class (AdapterTypeId property)

So I am exploring a Win 2008 Server machine with WMI queries on the Win32_NetworkAdapter class. This class is documented here: http://msdn.microsoft.com/en-us/library/aa394216(VS.85).aspx Here's what it says about the possible values of that property. There's also an AdapterType property that returns the same information, only in the fo...

Strange values of SystemType property of Win32_ComputerSystem WMI class?

According to the documentation at http://msdn.microsoft.com/en-us/library/aa394102%28VS.85%29.aspx this property may assume the following string values: "X86-based PC" "MIPS-based PC" "Alpha-based PC" "Power PC" "SH-x PC" "StrongARM PC" "64-bit Intel PC" "64-bit Alpha PC" "Unknown" "X86-Nec98 PC" Most of it is pretty obvious, but what...

Unable to make WMI connection from XP Pro machine to another (not in domain, same workgroup) in C#

I have two XP Pro SP3 machines. I disabled the firewall in both. The workgroup name is WORKGROUP. I have an administrator account with identical username/password in both. My code to connect is the following: ConnectionOptions options = new ConnectionOptions(); options.Username = myUsername; options.Password = myPassword; ...

How do I use a VBscript to determine if the monitor(s) connected to a machine is an LCD or CRT?

I am trying to add info to a VBscript that will determine if the monitor(s) connected to the current machine is an LCD or CRT. I know I can get the EDID info from HKLM\System\CCS\Enum\DISPLAY but I can't use that to determine the monitor type. And the only consistent info I can grab from the WMI classes Win32_DesktopMonitor, Win32_Disp...