View Single Post
Old 03-17-2008   #6 (permalink)
Charlie Russel - MVP


 
 

Re: Reliable way to get Windows Version?

Won't help - returns the exact same for Server 2008 and Vista with SP1. (and
has the same problem with XP x64 and Server 2003 SP1). And doesn't give me
edition so I can branch on features available.

--
Charlie.
http://msmvps.com/xperts64
http://mvp.support.microsoft.com/profile/charlie.russel


"Shay Levi" <no@xxxxxx> wrote in message
news:8766a94423a778ca5635947a6762@xxxxxx
Quote:

>
> You can also try the plain old DOS ver command:
>
>
> # on XP box
> PS> cmd /c ver
> Microsoft Windows XP [Version 5.1.2600]
>
> # on Win2003 server R2 x64
> PS> cmd /c ver Microsoft Windows [Version 5.2.3790]
>
> # on Windows 2000 STD Server SP4
> PS> cmd /c ver
> Microsoft Windows 2000 [Version 5.00.2195]
>
>
>
>
> -----
> Shay Levi
> $cript Fanatic
> http://scriptolog.blogspot.com
>
Quote:

>> I need a way to determine what Windows version and edition a script is
>> running on. I can get the build number, that's trivial:
>>
>> $Build=(get-item 'HKLM:/Software/Microsoft/Windows
>> NT/CurrentVersion').getvalue('CurrentBuildNumber')
>>
>> But it doesn't much help when Windows Vista SP1 is 6001 and so is
>> Windows Server 2008. And also doesn't tell me which edition. The
>> ProductID:
>>
>> $ProductID=(get-item 'HKLM:/Software/Microsoft/Windows
>> NT/CurrentVersion').getvalue('ProductID')
>>
>> could probably do it, but I'm not at all sure what I'm looking at
>> there, and how to parse it for what's important. First, does anyone
>> know a reference that gives the relevant numbers for the various
>> editions of Windows. And second, could someone suggest a regex to
>> parse it into consituent parts? Or, alternately, does someone have a
>> better location to get the version and edition of Windows?
>>
>> Thanks,
>>
>
>
My System SpecsSystem Spec