wmi

Getting WMI to read processor load faster.

Hi. I have a C# application, where I have to get the processor load. According to the accepted answer for this question, my options are to either use performance counters from either WMI or the System.Diagnostics namespace. I have a problem with the System.Diagnostics performance counter (as documented here), so my only option is to use...

Query for accurate and localized list of installed Windows updates

How can I query for an accurate and localized list of Windows updates installed on a machine using C#? I define accurate as matching what is displayed in the "Microsoft Windows" category of Microsoft's View Installed Updates dialog under Programs and Features in Windows 7. If I use WUApi.DLL, the information is returned localized but...

User permissions in WMI

Does anyone know which WMI Class is to be used to getting information of which users or user groups have permission for a given folder? ...

Get Total CPU # via WMI or T-SQL

I don't want the list of all process, just a total percentage like you would see in windows taskmanager. I will be using this information via coldfusion, but i am having all kinds of problems just trying to find a total number of current cpu usage. I don't care if it comes from wmi or t-sql, i just want a total number for which i wil...

vbscript: how to print multiple files with printer selection dialog once

I have to write vbscript that prints all files in a folder. Printer dialog should popup at the very beginning to allow user to select printer to use. Than all files should be send to printer silently How can I do that? Thank you in advance! ...

How can I programmatically create new sites in IIS 6?

Currently whenever a new subdomain is created for the site, a new host header value needs to be added manually in IIS for it to work (needs to work with and without SSL). Is there a way to set host header value via API so that subdomains can be created without human intervention? ...

how to get Operating System Details in C# code

i need to get OsArchitecture means Bits of O/s , i used Win32_OperatingSystem but its "OsArchitecture "is not work for all type Operating System ManagementObjectSearcher objOSDetails = new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem"); ManagementObjectCollection osDetailsCollection = objOSDetails.Get(); for...

Getting all virtual directories for a IIS6 web site using WMI

I want to list all virtual directories that belong to a web site with a certain name using WMI and PowerShell. I know I can list all virtual directories on a server using the code below, but how can I filter out only those that belong to a specific site? Get-WmiObject IIsWebVirtualDir -namespace "ROOT\MicrosoftIISv2" ...

using WMI to uninstall applications remotely

Hi, I am trying to write a mini w32 executable to remotely uninstall an application using WMI. I can list all the installed applications using this code below but i couldnt find a way to uninstall the application remotely thru WMI and C# I know I can do same using msiexec as a process but I wish to solve this using WMI if its possibl...

C# Accessing management objects in ManagementObjectCollection

I'm trying to access ManagementObjects in ManagementObjectCollection without using a foreach statement, maybe I'm missing something but I can't figure out how to do it, I need to do something like the following: ManagementObjectSearcher query = new ManagementObjectSearcher( "select Name, CurrentClockSpeed from Win32_Processor"); M...

WMI EventLog Time interval

Hie all, I'm trying to get eventlog entries using WMI and WQL. I can get the right log with the right sourcename of itand so on, but i can make a select query to only get result for the 5 or 10 past minutes. here is my query: ...

WMI - EventLog - Time interval

Hie all, I get through WMI Evenlogs matching specific criteria like Sourcename and Description and it's ok for that part. Now i'd like to get the same thing but in the 5 or 10 last minutes. I tried to use TimeGenerated and TimeWritten form the Win32_NTLogEvent but no success here is my basic query with no time: SELECT Logfile, Messa...

How can I get HBA information using C#? HBAAPI?

I see something interesting when I install the Exchange 2003 Best Practice Analyzer. It installs something called HBA API. Does anyone know what this is, or how I can use something similar to access HBA information of local and remote servers? ...

monitor WPD devices using WMI

I'm trying to monitor all removable devices that are installed on my computer, and for that I'm using the Win32_logicaldisk WMI class (for monitoring drive letters) The problem is that WPD devices (for example a photo camera which doesn't have a letter) don't show up there. Any idea if this can be done with WMI? ...

How to get an HTA to restart itself?

I have an HTML Application that I am using to build a kiosk environment. At the end of every session (when the user clicks "Logout" or after a timeout) I want the HTA to close itself and restart*. I was wondering how I would go about achieving this programatically with VBScript. The process should go something like this User clicks "l...

C#/WMI: How to remotely check if Windows has updates ready to be installed?

Hi I tried finding a solution for this on google without much luck, perhaps someone here knows how to do this? ...

I get an invalid query error when I add WHERE Name =

public static void Command(string vCommand, string machineName, string username, string password) { ManagementScope Scope = null; ConnectionOptions ConnOptions = null; ObjectQuery ObjQuery = null; ManagementObjectSearcher ObjSearcher = null; try ...

I get an "Invalid Name" error when I try to use "CopyEx".

Regarding my previous problem that is now fixed, I got another problem with the //code here part :/ foreach (ManagementObject obj in ObjSearcher.Get()) { ManagementBaseObject inputArgs = obj.GetMethodParameters("CopyEx"); inputArgs["FileName"] = "\\c:\\1stuff"; inputArgs["Recursive"] = true; ManagementBaseObject outPar...

ExecutionEngineException when calling method on decoupled WMI provider

I've run into a problem where calling a method on a decoupled WMI provider (developed using the WMI Provider Extensions in .NET 3.5) throws an ExecutionEngineException when running more than one instance of my application. Has anyone run into this limitation before or am I doing something wrong? I created a (simple) WMI provider and pub...

Finding processor usage through WMI.

I am trying to use the Win32_PerfRawData_PerfOS_Processor class on a windows server enterprise 2007 remotely to find the CPU usage. But I am getting huge 14-15 digit values like 11745679223456 %. Any idea why it is giving erroneous result? It seems to work fine on my server 2008. Is there any way I can reinstall these classes? P.S : I d...