I agree that using WMI is probably the best way to do this. Mainly
because it is documented, tested and supported. Using registry keys
should be considered a hack that may or may not work for older and newer
versions of the OS. 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Patrick J. LoPresti
Sent: Tuesday, January 06, 2004 11:13 AM
To: henry isham
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: Re: Getting Detailed OS Version

"henry isham" <[EMAIL PROTECTED]> writes:

> Hi All,
>  
> I'm trying to find a way to query the local machine to find out
> whether it's running Windows 2000 Professional/XP/Windows 2000
> server. I've looked into the HKLM\SOFTWARE\Microsoft\Windows
> NT\CurrentVersion key, but it doesn't tell whether it's a Pro or
> Server version. Does anyone know of a way to query the machine for
> this kind of detail? I'd really appreciate any help with
> this. Thanks!

By far the best way to do this is to use the "Caption" property of the
Win32_OperatingSystem class:

 
http://msdn.microsoft.com/library/en-us/wmisdk/wmi/win32_operatingsystem
.asp

(Note: In my experience, the documentation is wrong; the Caption
property includes exactly the string you want, like "Microsoft Windows
2000 Server".  If you actually want the version number, use the
"Version" property.)

For a sample script to enumerate the instances of any WMI class, see:

  http://unattended.sourceforge.net/apps.html#instances

Invoke it with "instances.pl Win32_OperatingSystem", for example.

 - Pat
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to