Jump to content

How do I get OS Version?


Recommended Posts

Hi, If I have the following....

MsgBox(0,"",@OSVersion)

I get a return of 'WIN_7' but How can I get the message box to say either 'Home Premium' or 'Ultimate' etc. I need the full windows version for 7.

thanks

Link to comment
Share on other sites

There are Windows API functions for this

Syntax for PowerBuilder:

Function Boolean GetVersionEx (Ref OSVERSIONINFOEX lpVersionInformation) Library "kernel32.dll" Alias For "GetVersionExA"
Function Boolean GetProductInfo (ulong dwOSMajorVersion, ulong dwOSMinorVersion, ulong dwSpMajorVersion, ulong dwSpMinorVersion, Ref ulong pdwReturnedProductType) Library "kernel32.dll"

Search this forum for example for these functions.

Link to comment
Share on other sites

Or this?

$colItems = ""
$Output=""
$objWMIService = ObjGet("winmgmts:\\localhost\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", 0x30)

If IsObj($colItems) then
   For $objItem In $colItems
      $Output = $objItem.Caption & " " & $objItem.Version & @CRLF
      if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop
      $Output=""
   Next
Else
   Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_OperatingSystem" )
Endif
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...