wmi

How to collect the new "Applications and Services Logs" found on Windows 7 or Windows Server 2008 using WMI?

In Windows Server 2008 and Windows 7 there are new Events categorized under "Applications and Services Logs". There is also a subfolder called Microsoft which has tons of subfolders as well. Is there any way to collect these events through WMI? For the regular "Windows Logs" such as Application and Security, it is possible to use the Wi...

How do I determine if VBScript is running in RDP Console?

I have an MSI installer that fails if it is running over remote desktop. (Unless it is run with the /admin or /console option so that it gets session 0) I want to use a VBScript custom action to determine if I am running as Session 0. I've learned that I can use two WMI calls to determine this: GetCurrentProcessID() ProcessIdToSessi...

WMI Win32_DiskDrive Capabilities Property - Convert UInt16 to String.

Hi guys. In Win32_DiskDrive. There's a Capabilities Property which has a type of System.UInt16[]. Am trying to get the values by using GetProperty and convert it to string. But it keeps throwing an error (I don't want to trap it) on Capabilities property. The error was: InvalidCastException Message: Object must implement IConvertible...

How to find available parallel ports and their I/O addresses using Delphi and WMI

I see that WMI is very powerful and seems to be able to return most properties of a PC hardware. I'd like to display the available parallel ports on any PC and find their I/O addresses - I know that normally this is done using a Kernel driver but this is a legacy need - dont ask! Presently we look in Device Manager and then have to type ...

Using WMI to uninstall programs

Hello, I want to uninstall a program using WMI, but I get this error : "Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))". Installing it worked without any problems, using the same ConnectionOptions. Is there any possibility that the Administrator user has rigths to install software, but not to uninstall? If so, ...

Remotely manage .net processes

I am going to be deploying a solution which includes a number of small long running processes which will live on a number of boxes. I wanted to develop a central dashboard for managing these processes and was looking for a good way to do so. I would want to get some counters from the processes and monitor things like memory usage and u...

How to retrieve vista's network status (e.g. "Local Only", "Local and Internet") in powershell

I have a flaky NIC that drops out from time to time, especially after resuming from hibernation. A drop-out corresponds to Vista's network status showing in the notification area as "Local Only". Is there a way of retrieving these status values (e.g. "Limited Connectivity", "Local Only", "Local and Internet") programmatically? I am writ...

Sending a Refresh() to WMI in PowerShell

In a PowerShell script I am trying to get the number of page faults per second with this command: (Get-WmiObject Win32_PerfFormattedData_PerfOS_memory).PageFaultsPersec Unfortunately, it reads always the same value because I don't Refresh() the performance counter. How can I send a Refresh() method to Pervormance Data via PowerShell?...

WMI Security error TF255437 when installing TFS 2010 RC

Does anyone know the resolution to the following error. In this scenario, TFS will be using a local report server instance which points uses a separate SQL Server database engine instance. An error occurred while querying the Windows Management Instrumentation (WMI) interface on the following computer databaseServer. The foll...

List of Installed Updates on Windows 7 C#

With Microsoft Ultimate Wisdom they have changed the location of updates from Registry. I can get the updates from Windows 2003 Servers no problem. Its just that Windows 7 is no longer in: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall Any body got any other ways to get it. Preferably in C# or using WMI? God S...

Network Authentication when running exe from WMI

Hi, I have a C# exe that needs to be run using WMI and access a network share. However, when I access the share I get an UnauthorizedAccessException. If I run the exe directly the share is accessible. I am using the same user account in both cases. There are two parts to my application, a GUI client that runs on a local PC and a backen...

Uninterruptible Windows Process

Hi Guys, We're starting a new custom project right now from a client and one of the requirements is the process cannot be terminated unless the system is shutting down, restarting, or logging-off. This application monitors the USB interface. We will be using WMI to query the device periodically. The client want's to run the applicatio...

64bit equivalent class for a wmi class "win32reg_addremoveprograms"?

My code below works perfectly on a 32-bit Windows machine, however it refuses to work on a 64-bit machine due to the 32-bit WMI class win32reg_addremoveprograms used in the code. Is there a 64-bit equivalent of this class? $ServerFile = "D:\SharePoint\Powershell\AddRemovePrograms\Machines.txt" $ServerList = Get-Content $ServerFile $Exc...

Programmatically manage IIS

Hello everyone. I am currently moving into the web-hosting league. I have to far been adding sites manually in the IIS Manager. But I wonder if there exists an interface, framework or something similair to manage the IIS over the internet - eg. an ASP.NET web-application? I've read something with WMI, but I am unsure if this is the rig...

12hive & GAC comparison?

Environment Overview: 3 WFEs 1 Admin Server 1 Index + 1 Query server Requirement: We want to generate the below reports We have to compare the "12hive" folder on a server with other servers. We have to compare the GAC of a server with other servers. thoughts? ...

WQL SELECT with optional column

I need to make a query like this: SELECT PNPDeviceID FROM Win32_NetworkAdapter WHERE AdapterTypeId = 0 Trouble is, the AdapterTypeId column isn't always present. In this case, I just want everything, like so: SELECT PNPDeviceID FROM Win32_NetworkAdapter My WQL/SQL knowledge is extremely limited. Can anybody tell me how to do th...

Way to know if two partitions are in one physical hard disk without WMI?

Hey. I have those partitions (in Windows) for example: Hard Disk 1 - Partition C, Partition D Hard Disk 2 - Partition E Is there any way in a program language to know if for example partition C and partition D are in one physical hard disk without WMI? I don't want to use WMI because it's slow - for this example, it took for me 0.5 ...

Associate mount points with local disks in VBscript / WMI

I have a VBscript that outputs various config items about a system. Both hardware and software. I can output disks and their associated partitions. I can output mount points. I do not seem to be able to associate a mount point with a local disk (where it actually is a local disk). I need to be able to do this using VBscript, so as to fi...

Constructor ManagementObject(string path) fails to parse strings obtained from querying Win32_GroupUser class (C#)

So, I WMI query a remote machine to get the members of its Administrators group: SELECT PartComponent FROM Win32_GroupUser WHERE GroupComponent = "Win32_Group.Domain='MACHINE_NAME',Name='Administrators'" It returns the PartComponent property as strings. Here's the list (names changed for security). Domain users joeblow and janedoe are...

How get Win32_OperatingSystem.LastBootUpTime in datetime format

I have been trying to get LastBootUpTime using Win32_OperatingSystem class (WMI). HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1, &pclsObj, &uReturn); if(0 == uReturn) { break; } VARIANT vtProp; // Get the value of the Name property hr = pclsObj->Get(L"LastBootUpTime", 0, &vtProp, 0, 0); ...