I need to find out which OS is running my vbs script (windows 2000 or
windows 98)
Does anyone have a hint ?
Thanks Brian
' 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
"Anthony Hunter" <anthony...@wonderware.com> skrev i en meddelelse news:3C0E863F...@wonderware.com...
"Brian Andersen" <reply@to_newsgroup.only> wrote in message news:#ygJ6GdfBHA.1712@tkmsftngp03...
"Matthew Schneider" <mds_...@hotmail.com> skrev i en meddelelse news:uyq2#TdfBHA.2088@tkmsftngp07...
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
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...