Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / August 2006

Tip: Looking for answers? Try searching our database.

Pulling Software Information using WMI

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
esparkman - 04 Aug 2006 14:29 GMT
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
Nicholas Paldino [.NET/C# MVP] - 05 Aug 2006 06:10 GMT
Evan,

   Exactly which line is the exception being thrown on?

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.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
[quoted text clipped - 15 lines]
> Thanks-
> Evan Sparkman
Willy Denoyette [MVP] - 05 Aug 2006 23:58 GMT
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
[quoted text clipped - 15 lines]
| Thanks-
| Evan Sparkman
esparkman - 07 Aug 2006 19:23 GMT
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.
[quoted text clipped - 20 lines]
> | Thanks-
> | Evan Sparkman
Ian R - 08 Aug 2006 16:30 GMT
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ProductId
No guarantee that it will be in the same place in future versions though.

> Willy,
>
[quoted text clipped - 39 lines]
>> | Thanks-
>> | Evan Sparkman
Willy Denoyette [MVP] - 23 Aug 2006 23:28 GMT
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,
|
[quoted text clipped - 38 lines]
| > | Thanks-
| > | Evan Sparkman

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.