If Windows 2000 Then
'run this script......
If Windows XP Then
'run this scripts
etc......
Hope this helps.
Jeff Wright
if GetOS = ("WXP") then
' DO SOMETHING
Else
if GetOS = ("W2k") then
' DO SOMETHING FOR 2000
Else
' Tell the user the script is designed to run on Windows XP or
' Windows 2000 and exit
End if
End if
'##################################################################
Function GetOS()
' From Torgeir Bakken
' using the ver command
Const OpenAsASCII = 0
Const FailIfNotExist = 0
Const ForReading = 1
Set oShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
sTemp = oShell.ExpandEnvironmentStrings("%TEMP%")
sTempFile = sTemp & "\runresult.tmp"
oShell.Run "%comspec% /c ver >" & sTempFile, 0, True
Set fFile = oFSO.OpenTextFile(sTempFile, ForReading, _
FailIfNotExist, OpenAsASCII)
sResults = fFile.ReadAll
fFile.Close
oFSO.DeleteFile(sTempFile)
Select Case True
Case InStr(sResults, "Windows 95") > 1 : GetOS = "W95"
Case InStr(sResults, "Windows 98") > 1 : GetOS = "W98"
Case InStr(sResults, "Windows Millennium") > 1 : GetOS = "WME"
Case InStr(sResults, "Windows NT") > 1 : GetOS = "NT4"
Case InStr(sResults, "Windows 2000") > 1 : GetOS = "W2k"
Case InStr(sResults, "Windows XP") > 1 : GetOS = "WXP"
Case Else : GetOS = "Unknown"
End Select
End Function
'################################################################
J
On Fri, 21 Jun 2002 13:45:27 GMT, Jeff Wright <jsw...@yahoo.com>
wrote:
"CodeAnimal.com" <in...@codeanimal.com> wrote in message
news:OTyp$ZSGCHA.2616@tkmsftngp10...
"Jeff Wright" <jsw...@yahoo.com> wrote in message
news:j6b6huo5676vceg0a...@4ax.com...
"Chris Shelley [MS]" <cshe...@online.microsoft.com> wrote in message
news:OzQldATGCHA.2680@tkmsftngp12...
> Can someone help me write a script to detect the OS of a machine? The script
> will be running on a server and remote work stations (with any MS OS) will be
> connecting to it.
Try my osver.exe.
http://mywebpages.comcast.net/stewartb/files/admtool2.zip
Usage: OSVER [-s] [-t] [-q]
Without -s or -t, returns OS version as an exit code value:
0 = Unknown OS
1 = Windows 95
2 = Windows 98
3 = Windows Me
4 = Windows NT 4.0
5 = Windows 2000
6 = Windows XP
With -s, returns the NT (or later) service pack number as an
exit code value. -s on a non-NT system returns an exit code of 99.
With -t, returns NT type:
0 = Not running NT/failed to determine NT type
1 = Workstation
2 = Server (not domain controller)
3 = Server (domain controller)
-q specifies quiet mode (no output).