Pulling Software Information using WMI

  • Thread starter Thread starter esparkman
  • Start date Start date
E

esparkman

Hey guys I am working on a application, that will pull our inventory
campus wide. I'm having troubles getting it to pull our software serial
numbers. It keeps throwing a Exception when it gets to that point.
Below is the code I am using. If someone could give me a few ideas. The
app is in Console form now to be translated to a Windows App at a
future date.

query1 = new ManagementObjectSearcher("SELECT * FROM Win32_Product");
queryCollection1 = query1.Get();
foreach (ManagementObject mo in queryCollection1)
{
Console.WriteLine("Product : " +
mo["Name"].ToString());
Console.WriteLine("Serial : " +
mo["ProductID"].ToString());
}

Thanks-
Evan Sparkman
 
There is no such property as ["ProductID"] in Win32_Product, please refer to
the WMI docs for property details.

Willy.

| Hey guys I am working on a application, that will pull our inventory
| campus wide. I'm having troubles getting it to pull our software serial
| numbers. It keeps throwing a Exception when it gets to that point.
| Below is the code I am using. If someone could give me a few ideas. The
| app is in Console form now to be translated to a Windows App at a
| future date.
|
| query1 = new ManagementObjectSearcher("SELECT * FROM Win32_Product");
| queryCollection1 = query1.Get();
| foreach (ManagementObject mo in queryCollection1)
| {
| Console.WriteLine("Product : " +
| mo["Name"].ToString());
| Console.WriteLine("Serial : " +
| mo["ProductID"].ToString());
| }
|
| Thanks-
| Evan Sparkman
|
 
Willy,

This is under the WMI Class Win32_Product:

ProductID
Data type: string
Access type: Read-only

The product ID.

Windows Server 2003, Windows XP, and Windows 2000: This property is
not available.



Either way could you point me in the direction to retrieve the CD-KEY?
We are a College Campus located in KY, I am writing this so that it
will give us freedom and control of the assest management we use. As
well as give us a some form of inventory control.
 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ProductId
No guarantee that it will be in the same place in future versions though.

esparkman said:
Willy,

This is under the WMI Class Win32_Product:

ProductID
Data type: string
Access type: Read-only

The product ID.

Windows Server 2003, Windows XP, and Windows 2000: This property is
not available.



Either way could you point me in the direction to retrieve the CD-KEY?
We are a College Campus located in KY, I am writing this so that it
will give us freedom and control of the assest management we use. As
well as give us a some form of inventory control.

There is no such property as ["ProductID"] in Win32_Product, please refer
to
the WMI docs for property details.

Willy.

| Hey guys I am working on a application, that will pull our inventory
| campus wide. I'm having troubles getting it to pull our software serial
| numbers. It keeps throwing a Exception when it gets to that point.
| Below is the code I am using. If someone could give me a few ideas. The
| app is in Console form now to be translated to a Windows App at a
| future date.
|
| query1 = new ManagementObjectSearcher("SELECT * FROM Win32_Product");
| queryCollection1 = query1.Get();
| foreach (ManagementObject mo in queryCollection1)
| {
| Console.WriteLine("Product : " +
| mo["Name"].ToString());
| Console.WriteLine("Serial : " +
| mo["ProductID"].ToString());
| }
|
| Thanks-
| Evan Sparkman
|
 
Not sure what documentation you are refering to, but this property is not in
Win32_product and not in the recent MSDN docs.

also:
| Windows Server 2003, Windows XP, and Windows 2000: This property is
| not available.

is a bit indicative for what I'm saying, provided that NT4 is no longer
supported and W9X isn't even a WMI platform.

Willy.


| Willy,
|
| This is under the WMI Class Win32_Product:
|
| ProductID
| Data type: string
| Access type: Read-only
|
| The product ID.
|
| Windows Server 2003, Windows XP, and Windows 2000: This property is
| not available.
|
|
|
| Either way could you point me in the direction to retrieve the CD-KEY?
| We are a College Campus located in KY, I am writing this so that it
| will give us freedom and control of the assest management we use. As
| well as give us a some form of inventory control.
|
|
| Willy Denoyette [MVP] wrote:
| > There is no such property as ["ProductID"] in Win32_Product, please
refer to
| > the WMI docs for property details.
| >
| > Willy.
| >
| > | > | Hey guys I am working on a application, that will pull our inventory
| > | campus wide. I'm having troubles getting it to pull our software
serial
| > | numbers. It keeps throwing a Exception when it gets to that point.
| > | Below is the code I am using. If someone could give me a few ideas.
The
| > | app is in Console form now to be translated to a Windows App at a
| > | future date.
| > |
| > | query1 = new ManagementObjectSearcher("SELECT * FROM Win32_Product");
| > | queryCollection1 = query1.Get();
| > | foreach (ManagementObject mo in queryCollection1)
| > | {
| > | Console.WriteLine("Product : " +
| > | mo["Name"].ToString());
| > | Console.WriteLine("Serial : " +
| > | mo["ProductID"].ToString());
| > | }
| > |
| > | Thanks-
| > | Evan Sparkman
| > |
|
 
Back
Top