Jump to content
Sign in to follow this  
Emiel Wieldraaijer

Retrieve Windows version

Recommended Posts

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



Share this post

Link to post
Share on other sites

You can get that info from WMI.

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



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

@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]


Edited by 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  

  • Create New...