wmi

Add New ServerBinding to IIS 6 site using WMI and Powershell

Given a valid $server, the following code will move all the ServerBindings from their existing subnet to a nice, shiny new one at 1.1.1. $objWMI = [WmiSearcher] "Select * From IIsWebServerSetting WHERE Name = 'w3svc/10'" $objWMI.Scope.Path = "\\" + $server + "\root\microsoftiisv2" $objWMI.Scope.Options.Authentication = 6 $sites =...

How to update existing IIS 6 Web Site using PowerShell

Hi, I am trying to create a PowerShell script that creates a new IIS 6 web site and sets things like App Pool, Wildcard application maps, ASP.NET version, etc. After extensive search on the Internet I found a script that allows me to create a new Web Site but not to modify all the properties I need. $newWebsiteName = "WebSiteName...

Finding ALL installed applications with PowerShell?

I am trying to use Windows PowerShell 2.0 to find an installed application. I have tried two methods, one using WMI and one using the Registry. Both methods are able to bring up a large list of installed applications and components, however neither one seems to bring up the application I am interested in. I am specifically looking for ...

"Invalid Class" Error while Starting FTp Site in IIS 7.0 using WMI and ASP.Net C# (windows Server 2008)

Hi all. I am working on an ASP.Net Web Site Provisioning software using WMI(System.Managment) and C#. I am trying to create FTP site on my "Target Server" located somewhere on LAN while executing code on my host machine. I have trouble starting the FTP Site after its creations. The error being reported is "Invalid Class" on the follo...

WMI ManagementObjectSearcher Invalid Class

Hello I've got a bit of a problem. I'm trying to use WMI to list information about disks. When I run the code from the WMI code creator everything returns fine and I get the information I'm looking for. When I run the code from the application I'm writing I get an invalid class error that gets thrown from the foreach loop. The code...

How to create FTP Site in IIS 7 using WMI and C# from ASP.Net Web Application?

Hi all, I am working on a website provisioning system using IIS 7 (and IIS6) and using C# as development Tool (under .Net 3.5) using WMI. I want to create FTP Site via code in C# using WMI. I cant want to use MWA(Microsoft.Web.Administration) because I have to support older version a.k.a IIS 6 as well. I believe its possible via WMI. ...

How to add New Application mapping in IIS6 and IIS 7 programmatically using WMI and C# ?

Hi all, My goal is to add php Extension to IIS6 and IIS 7 via Code in C# using WMi (System.Management). I cant use DirectoryEntry. I am stuck with adding a new ScriptMap Object to IIS 6/IIS7. I have read some posts at here and there and heard that adding new WMi object from Scratch is difficult. I want to enable IIS 6/IIS7 to hand...

How to add Custom Property to System.Managment Object using WMI, C# in ASP.Net Application?

AA, I want to add a custom property to a WMi Object's Propert Collection. So that whenever i retrieve the properties of that object, i get the custom added property as well. Specifically speaking lets see the following code. foreach (ManagementObject WebSite in WebSitesCollection) { if (WebSite.Properties["Name"].Va...

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

i want to call this class from my Winform.But if i write this codes. Compiler send me error. What is solution. Please help me Error : 'CERas.CERAS' is a 'type', which is not valid in the given context using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WinApp_WMI2 { public partial clas...

Finding USB serial ports from a .NET application under Windows 7

I have an application that looks for a specific FTDI serial port with customised USB descriptors. My current code uses the example from Code Project, which searches the MSSerial_PortName WMI table under root\WMI, and pulls out extra USB information from root\CIMV2\WIN32_PnPEntity. This worked well under XP, but the application must also...

C# WMI runs an exe on a remote computer that then runs another exe on the same computer that then calls Directory.CreateDirectory on a network path and fails. What am I missing?

Using C# WMI I start an exe on another computer and this exe starts another exe using the C# Process class. The last exe tries to call Directory.CreateDirectory using a network path (aka \\comp1\d$\dir). Directory.CreateDirectory throws this exception: Access to the path '\\\\blah\blah\blah' is denied. at System.IO.__Error.WinIOError(...

python and process

Hi, What is the best way in python find the process name and owner? Now i use WMI, but this version is too slow. ...

Is there a possibility to differ virtual printer from physical one?

Hi. I have a list of all printers available in WinXP. I need the code (ideally .NET) to filter out all the virtual printers from this list. Is it possible to do? I analyzed all the properties of Win32_Printer wmi class but can't see any suitable one. Please help. ...

How do I enumerate network adapters on a Hyper-V guest using WMI?

I've got a Hyper-V host, with several guests, each with one or more network adapters. How do I enumerate the network adapters on those guests? Specifically, I'm looking for a particular guest, given a MAC address. I'm using C# and System.Management. ...

WMI: How to distinguish between an internal "local disk" HDD and an external "local disk" HDD

Background I've been using Win32_DiskDrive to find flash memory (usb pens, SD cards, etc.), but after some tests on other computers I noticed that they weren't always discovered. So I am using Win32_LogicalDisk and since it has DriveType I don't have to associate with two classes (e.g. partition) to find first the drives then their drive...

Convert WMI Win32_OperatingSystem InstallDate to mm/dd/yyyy format (C# - WPF)

Hi, I am wondering how you would convert the date and time from 20100131022308.000000-360. I've been trying to figure it out for a while now and I can't seem to get anywhere. I am using C# in a WPF Application. ...

Reporting Services WMI Error

I've never used SSRS before and I want to have a play around with it on my local machine to see if it's a good fit for a project. I have the full (advanced services) version of SQL Server 2008 Express installed, according to the web installer. However, when I fire up Reporting Services Configuration Manager and try to connect to my loc...

Access Denied For WMI Impersonated User

I'm trying to use WMI to pull some information (hard drive usage, etc) off our SQL server from a scheduled task on a different server. Both machines have the same user account with the same password. Unfortunately, whenever I try to run the below code, I get "Access denied". The below code works when I make the user on the remote box an...

Get full CPU name without WMI

Does anyone know if it's possible to get the full processor name (as shown in Control Panel | System) without using WMI? I'm guessing there's some unmanaged call you can make. WMI does the job, but I'm finding it intermittently crashes or locks up on some computers. ...

Get first record from WMI ExecQuery

I have a simple vbscript for retrieving Windows version: Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") Set colVersions = objWMI.ExecQuery("Select * from Win32_OperatingSystem") For Each objVer in colVersions ver = objVer.Version Next Is is possible to get the first record or do I have to loop o...