473,396 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Pulling Software Information using WMI

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

Aug 4 '06 #1
5 5144
Evan,

Exactly which line is the exception being thrown on?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"esparkman" <ev***********@gmail.comwrote in message
news:11*********************@i42g2000cwa.googlegro ups.com...
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

Aug 5 '06 #2
There is no such property as ["ProductID"] in Win32_Product, please refer to
the WMI docs for property details.

Willy.

"esparkman" <ev***********@gmail.comwrote in message
news:11*********************@i42g2000cwa.googlegro ups.com...
| 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
|
Aug 5 '06 #3
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.

"esparkman" <ev***********@gmail.comwrote in message
news:11*********************@i42g2000cwa.googlegro ups.com...
| 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
|
Aug 7 '06 #4
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curr entVersion\ProductId
No guarantee that it will be in the same place in future versions though.

"esparkman" <ev***********@gmail.comwrote in message
news:11**********************@75g2000cwc.googlegro ups.com...
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.

"esparkman" <ev***********@gmail.comwrote in message
news:11*********************@i42g2000cwa.googlegr oups.com...
| 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
|

Aug 8 '06 #5
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.
"esparkman" <ev***********@gmail.comwrote in message
news:11**********************@75g2000cwc.googlegro ups.com...
| 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.
| >
| "esparkman" <ev***********@gmail.comwrote in message
| news:11*********************@i42g2000cwa.googlegro ups.com...
| | 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
| |
|
Aug 23 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: James | last post by:
Hi, I'm trying to obtain information from a 3rd party software, using ASP .NET. The software only comes with a Java API that I can use or a telnet interface. Through telnet, I had to parse the...
10
by: Jeff | last post by:
Hey gang. i have a code that i will list. when varM = 8 or 16, the script works fine, and pulls the top 8 or top 16, but if it =32 or 64, it is only pulling the top 17 records from the DB. db is...
26
by: Swroteb | last post by:
Hi there, I've got a reasonably sized list of objects that I'd like to pull out all combinations of five elements from. Right now I have a way to do this that's quite slow, but manageable. I...
5
by: akelly_image | last post by:
Okay, if anyone could toss me some idea's here, please bare with my noobish questions, I just picked up VB2005 Pro about a week ago. ( no prior VB at all ) Here's my issue.. I'm pulling...
2
by: Joe Spears | last post by:
Hi Does anyone have any sample code on Pulling user data from Active Directory?? Thanks
1
by: relisoft | last post by:
SEATTLE, Washington. - July 12, 2006: Reliable Software® announces the upcoming release of Code Co-op® version 5.0. Code Co-op is an affordable peer-to-peer version control system for distributed...
3
by: piscogirl | last post by:
Hi there, I am about to build a small db in Access. Among the tables I plan to have are a Person table, an Event table, and an EventRegistration table. The EventRegistration table will...
5
by: Stewart | last post by:
Hi there, I have an Access database, which contains the details of company staff and services. The plan is to extract data from this database onto our forthcoming Intranet (no inserting,...
7
by: colleen1980 | last post by:
Hi: When i run the same code with minor changes in VB it works fine but when i run in ASP it runs but it not pulling any information from the web site. Needs help Thanks, Anna. ASP CODE ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.