Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

which os is running

582 views
Skip to first unread message

Brian Andersen

unread,
Dec 5, 2001, 2:34:39 PM12/5/01
to
Hi there

I need to find out which OS is running my vbs script (windows 2000 or
windows 98)

Does anyone have a hint ?

Thanks Brian


Anthony Hunter

unread,
Dec 5, 2001, 3:40:31 PM12/5/01
to
    Try this. It is from the Microsoft Platform SDK.
 

' Copyright (c) 1997-1999 Microsoft Corporation
'***************************************************************************
'
' WMI Sample Script - Information about the OS (VBScript)
'
' This script demonstrates how to retrieve the info about the OS on the local machine from instances of
' Win32_OperatingSystem.
'
'***************************************************************************
Set SystemSet = GetObject("winmgmts:").InstancesOf ("Win32_OperatingSystem")

for each System in SystemSet
 WScript.Echo System.Caption
 WScript.Echo System.Manufacturer
 WScript.Echo System.BuildType
 WScript.Echo " Version: " + System.Version
 WScript.Echo " Locale: " + System.Locale
 WScript.Echo " Windows Directory: " + System.WindowsDirectory
 WScript.Echo " Total memory: " + System.TotalVisibleMemorySize + " bytes"
 WScript.Echo " Serial Number: " + System.SerialNumber
 Wscript.Echo ""
next
 
 

Anthony

Brian Andersen

unread,
Dec 5, 2001, 4:10:07 PM12/5/01
to
Thanks, but when I ran this on a win98 is comes out with a vbscript failure.
on w2k is works just fine
 
Brian
"Anthony Hunter" <anthony...@wonderware.com> skrev i en meddelelse news:3C0E863F...@wonderware.com...

Matthew Schneider

unread,
Dec 5, 2001, 4:36:17 PM12/5/01
to
You need to install WMI on your Win98 computer, it is not defaultly.
"Brian Andersen" <reply@to_newsgroup.only> wrote in message news:#ygJ6GdfBHA.1712@tkmsftngp03...

Brian Andersen

unread,
Dec 5, 2001, 5:17:00 PM12/5/01
to
Thanks, It works fine
Brian
"Matthew Schneider" <mds_...@hotmail.com> skrev i en meddelelse news:uyq2#TdfBHA.2088@tkmsftngp07...

Torgeir Bakken

unread,
Dec 6, 2001, 2:49:45 AM12/6/01
to
Hi

If you don't want to install WMI on your W9x machines, take a look at this
thread for a script that reads from registry to detect OS version:

From: Greg Burns (greg_...@hotmail.com)
Subject: Re: Get os version
Newsgroups: microsoft.public.scripting.wsh
Date: 2001-06-26 12:21:58 PST

If you want to add support for Windows XP, add an Elseif testing for 5.1 (copy
the W2000/5.0 test).

You can use http://groups.google.com/advanced_group_search to fetch it :-)

--
torgeir

Alex Angelopoulos

unread,
Dec 6, 2001, 5:50:16 AM12/6/01
to
One other tmodification I always like to make to these scripts is to make
"tech-friendly" output. IN the appropriate environment (technicians who
know what is going on) I like to leave the version strings as is: less
coding work and I always have a precise version number staring at me.

If that is not something comfortable for you, at least echo it back when you
have an "unknown" OS.

For "friendly" information on NT-like OSes, you can use the value of
ProductName under "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion" instead of doing heavy logic. For a case statement, the
data from CurrentBuild or CurrentBuildNumber in the same location will give
you a short, simple string that precisely defines the version of the OS.

"Torgeir Bakken" <Torgeir.B...@hydro.com> wrote in message
news:3C0F2319...@hydro.com...

0 new messages