Find OS name / version using JScript
1 answer
Take a look here for all the system information you can get.
Here is some sample code I put together based on this web page:
var wbemFlagReturnImmediately = 0x10;
var wbemFlagForwardOnly = 0x20;
var objWMIService = GetObject("winmgmts:\\\\.\\root\\CIMV2");
var colItems = objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL",
wbemFlagReturnImmediately | wbemFlagForwardOnly);
var enumItems = new Enumerator(colItems);
var objItem = enumItems.item();
WScript.Echo("Caption: " + objItem.Caption);
+5
source to share