Error DataBase-One Place all Solutions Forums Blog Glossary    Contact Us
Search  
   
Browse by Category
Error DataBase-One Place all Solutions .: Operating Systems .: Windows Operating Systems .: Windows Scripts and Batch Files .: VB Script to Get Computers Version Number

VB Script to Get Computers Version Number


Option Explicit
Dim objWMI, objItem, colItems
Dim strComputer, VerOS, VerBig, Ver9x, Version9x, OS, OSystem

On Error Resume NExt
strComputer = "."
' This is where WMI interrogates the operating system
Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMI.ExecQuery("Select * from Win32_OperatingSystem",,48)

' Here we filter Version from the dozens of properties
For Each objItem in colItems
VerBig = Left(objItem.Version,3)
Next

'5.0 = W2K
'5.1 = XP
'5.2 = Windows 2003
'4.0 = NT 4.0

Msgbox(VerBig)

On Error Goto 0

WScript.Quit


How helpful was this article to you?

Related Articles

article VBScript to show the operating system version number
The purpose of this script is to...

(No rating)  5-1-2008    Views: 132   
article VB Script to Remove the OS Version Check from an MSI file
Description: create vbs file and drag...

(No rating)  3-24-2008    Views: 136   
article VB Script to Find Service Pack Version
strComputer = "."Set...

(No rating)  3-24-2008    Views: 172   

User Comments

Add Comment
No comments have been posted.