Sign in to follow this  
Followers 0
Emiel Wieldraaijer

Retrieve Windows version

8 posts in this topic

Hi All,

is there a way to retrieve the windows version like displayed in ControlPanel/System

for example

Windows 2000 Professional/Server/Advanced Server

Windows XP Home/Professional/Media Center Edition

Windows Vista Home Basic/Home Premium/Business/Ultimate

Windows 2003 Web/Standard/Enterprise/Datacenter

Thnx

Emiel


Best regards,Emiel Wieldraaijer

Share this post


Link to post
Share on other sites



Hi Zedna,

thnx

but it does not retrieve the information i want .. or i have the wrong version of it .. there are also some errors in the script .. not all information is retrieved correctly ..

Emiel


Best regards,Emiel Wieldraaijer

Share this post


Link to post
Share on other sites

You can get that info from WMI.

CODE
dim $strData

$objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & "localhost" & "\root\cimv2")

$colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_OperatingSystem")

For $objItem in $colItems

$strData = $strData & "Caption - " & $objitem.Caption & @crlf

$strData = $strData & "BuildNumber - " & $objitem.BuildNumber & @crlf

$strData = $strData & "CSDVersion - " & $objitem.CSDVersion & @crlf

$strData = $strData & "Version - " & $objitem.Version & @crlf

Next

msgbox(0,"Results",$strData)

I believe they translate the build and ver number into version 200X on the System Info applet. Hope that helps.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

@spudw2k and @zedna

Thnx for the example ..

but when i look at http://msdn2.microsoft.com/en-us/library/aa394239.aspx

i'll have to use the OperatingSystemSKU

but i get the following error message "The requested action with this object has failed."

These option is left out of the compinfo udf maybe for the same reason ..

[edit]aha i see "Windows Server 2003, Windows XP, Windows 2000, and Windows NT 4.0 not supported" so will work only in vista..[/edit]

Emiel

Edited by Emiel Wieldraaijer

Best regards,Emiel Wieldraaijer

Share this post


Link to post
Share on other sites

Always use Search function.

Here is the link

Hi Zedna,

strange .. before i asked the question i searched for OSVersion.. but didn't find the answer..

But thanks..

this will solve my question

Emiel


Best regards,Emiel Wieldraaijer

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0