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

How do script the install/update for NT4 and Win2k?

0 views
Skip to first unread message

Aaron Smith

unread,
Mar 25, 2002, 7:20:50 PM3/25/02
to
I want to automate WSH version checking and the
install/update process for Win98/WINNT/WIN2K clients.
Since there are two different install files, how do I
detect if the OS is NT4 or Win2k? The %OS% varible
simply returns "Windows_NT". Since it's possible that
WSH won't be installed at all (NT4) I want to determine
the OS type in a .bat file and execute the appropriate
package.

Assuming that I find a way to do this, will these
packages work on a freshly installed NT4 system with IE2?

Do the packages require a reboot before any scripts can
be processed?

Thanks,
Aaron

fdsf

unread,
Mar 25, 2002, 9:34:42 PM3/25/02
to
Try the "ver" command to determine the OS in batch.

I don't know what packages you are refering to so I can't answer that.


"Aaron Smith" <no...@home.com> wrote in message
news:164201c1d45c$156317e0$9ee62ecf@tkmsftngxa05...

Alex K. Angelopoulos

unread,
Mar 25, 2002, 10:26:52 PM3/25/02
to
AFAIK, you will _have_ to reboot. There are significant changes to the shell itself internally which occurred over the lifetime of NT4.

The comment about using "ver" is correct - it will return you a string which is parsable for the info you want.


"Aaron Smith" <no...@home.com> wrote in message news:164201c1d45c$156317e0$9ee62ecf@tkmsftngxa05...

Torgeir Bakken

unread,
Mar 25, 2002, 11:00:55 PM3/25/02
to
Aaron Smith wrote:

> I want to automate WSH version checking and the
> install/update process for Win98/WINNT/WIN2K clients.

See batch file at end, it is using environment variables to detect OS type, and
a flag file to see if WSH 5.6 is installed. (IE 6.0 installs WSH 5.6, but it has
a bug, so you should run the redistributable install anyway, it is newer and the
bug is fixed there)


> Assuming that I find a way to do this, will these
> packages work on a freshly installed NT4 system with IE2?

No, you will need at least IE 4 installed before you install WSH.


> Do the packages require a reboot before any scripts can
> be processed?

It depends. In most cases, no. On machines where WSH is non-existant, the
install will not need a reboot. It might happen that the upgrade wants to boot
on Win2000. Win2000 comes with WSH 5.1, and so long as your initial scripts
doesn't use any new WSH 5.6 functionality, the script will run. But I strongly
recommend that you let the install reboot if it wants to (with or without user
intervention).

Note: The WNT/W2k/WXP users *must* run under local admin rights on the computers
for WSH to install.


I also recommend to install the updated vbscript.dll in this security update:

Security Update, February 14, 2002
http://www.microsoft.com/windows/ie/downloads/critical/q318089/default.asp

The text in the download page can be misleading, the different update files are
for different versions of WSH, and _not_ for different versions of Internet
Explorer.

So, if you are running Internet Explorer 5.x, but you have upgraded to WSH 5.6,
you must then download the fix for Internet Explorer 6.0
vbs56nen.exe/vbs56men.exe)!

IE 6 eq. WSH 5.6
IE 5.5 eq. WSH 5.5
IE 501 eq. WSH 5.1

vbs56nen.exe is for Win2000 and WinXP, vbs56men.exe is for all other OSs.


The switches below is for both the WSH install and the security upgrade:

Using the /q:a switch, you will supress any messages, also reboots/reboot
messages as well. /q alone will be a silent install, but give the user the
option to reboot if necessary.

You can also control or force restart with /R (you might have to change /q:a to
/q for this?):

a.. R = /R:A (Default)
b.. /R:= /R:A (Default)
c.. /R:N -- Never reboot, overrides INF settings in package
d.. /R:A -- Always reboot, prompt user with reboot choice
e.. /R:I -- Reboot if needed, prompt user with reboot choice
f.. /R:AS -- Always reboot, silent and don't prompt user
g.. /R:IS -- Silent reboot if needed, silent and don't prompt user


A summary (silent install):

No reboot prompt or reboot: /q:a
Let the package and the user decide a reboot: /q
Let the package decide and commit a reboot: /q /r:is


Here a batch file that installs WSH 5.6 silently and creates a "flag" file so it
will happens only once. Enable the install by removing :: for the actual OS's.
If you supress reboot, you can add the security fix to be run on the line after
the main WSH install and let them share flag file. If you set the install to
reboot if needed, use the second batch file (further below). DO TEST!


@ECHO OFF
:: Using this file to test for WSH
IF EXIST %WINDIR%.\WSH56.LOG GOTO LOGINSCRIPT

:: Test for Win9x/ME
IF NOT "%OS%"=="Windows_NT" GOTO INSTALLScr

:: Test for WinXP
IF NOT "%SESSIONNAME%"=="" GOTO INSTALLScrXP

:: Test for Win2000
IF NOT "%ALLUSERSPROFILE%"=="" GOTO INSTALLScr2k

:: Then it has to be NT 4.0
GOTO INSTALLScr

:INSTALLScr
ECHO. Installing Windows Script Host for W9x/NT 4.0
:: Remove :: on the two lines below to activate
::ECHO.WSH is now installed>%WINDIR%.\WSH56.LOG
::\\Server03\Software\scr56en.exe /q:a
GOTO LOGINSCRIPT

:INSTALLScrXP
ECHO. Installing Windows Script Host for WinXP
:: Fix from Windows Update (MS KB Q318089)
:: Remove :: on the two lines below to activate
::ECHO.WSH is now installed>%WINDIR%.\WSH56.LOG
::\\Server03\Software\vbs56nen.exe /q:a
GOTO LOGINSCRIPT

:INSTALLScr2K
ECHO. Installing Windows Script Host for Win2k
:: Remove :: on the two lines below to activate
::ECHO.WSH is now installed>%WINDIR%.\WSH56.LOG
::\\Server03\Software\scripten.exe /q:a
GOTO LOGINSCRIPT

:LOGINSCRIPT
ECHO. Starting loginscript
:: Call your loginscript here

GOTO EXIT

:EXIT

--- Separate flag file for main install and security update ---

:: Log file for main install is WSH56.LOG
:: Log file for security update is WSH56.SEC

@ECHO OFF
:: Using this file to test for WSH and security fix.
IF EXIST %WINDIR%.\WSH56.SEC GOTO LOGINSCRIPT

:: Test for Win9x/ME
IF NOT "%OS%"=="Windows_NT" GOTO INSTALLScr

:: Test for WinXP
IF NOT "%SESSIONNAME%"=="" GOTO INSTALLScrXP

:: Test for Win2000
IF NOT "%ALLUSERSPROFILE%"=="" GOTO INSTALLScr2k

:: Then it has to be NT 4.0
GOTO INSTALLScr

:INSTALLScr
ECHO. Installing Windows Script Host for W9x/NT 4.0
IF EXIST %WINDIR%.\WSH56.LOG GOTO INSTALLSecFixMEN
:: Remove :: on the two lines below to activate
::ECHO.WSH is now installed>%WINDIR%.\WSH56.LOG
::\\Server03\Software\scr56en.exe /q:a
GOTO INSTALLSecFixMEN

:INSTALLScrXP
ECHO. Installing Windows Script Host for WinXP
:: Only fix from Windows Update is needed (MS KB Q318089)
:: Remove :: on the line below to activate
::ECHO.WSH is now installed>%WINDIR%.\WSH56.LOG
GOTO INSTALLSecFixNEN

:INSTALLScr2K
ECHO. Installing Windows Script Host for Win2k
IF EXIST %WINDIR%.\WSH56.LOG GOTO INSTALLSecFixNEN
:: Remove :: on the two lines below to activate
::ECHO.WSH is now installed>%WINDIR%.\WSH56.LOG
::\\Server03\Software\scripten.exe /q:a
GOTO INSTALLSecFixNEN

:INSTALLSecFixMEN
ECHO. Installing WSH Security Fix
::MS KB Q318089 for Win9x, WinME and NT 4.0
:: Remove :: on the two lines below to activate
::ECHO.WSH fix is now installed>%WINDIR%.\WSH56.SEC
::\\Server03\Software\vbs56men.exe /q:a
GOTO LOGINSCRIPT

:INSTALLSecFixNEN
ECHO. Installing WSH Security Fix
::MS KB Q318089 for Win2000 and WinXP
:: Remove :: on the two lines below to activate
::ECHO.WSH fix is now installed>%WINDIR%.\WSH56.SEC
::\\Server03\Software\vbs56nen.exe /q:a
GOTO LOGINSCRIPT

:LOGINSCRIPT
ECHO. Starting loginscript
:: Call your loginscript here

GOTO EXIT

:EXIT

--
torgeir


Alfred Falk

unread,
Mar 26, 2002, 3:07:44 PM3/26/02
to
"Aaron Smith" <no...@home.com> wrote in news:164201c1d45c$156317e0
$9ee62ecf@tkmsftngxa05:

I've got complete scripts listed below. We have a mix of mostly W98,
very few W95, some WNT4, and a larger number of W2K. This script ran
without problem on most workstations and servers. Users are encouraged
to power down overnight, but not all do that. When I started this, I
didn't hear about many problems. (Out of 600 there were 1 W95 and 2
WNT4 systems that were quite difficult to fix.)

This script ran successfully on a fresh WNT4 install, which has only IE
2.0. It might have required a reboot, I don't remember.


LOGIN.BAT
===================
@ECHO off
@ECHO * Welcome to ARC domain!


@EcHO * Installing/Updating WSH/VBS
SET loc="%windir%\wscript.exe"
IF "%OS%" == "Windows_NT" SET loc="%windir%\system32\wscript.exe"
IF NOT EXIST %loc% \\server\Core-Software\WSH\Script56_9xNt.exe /q:a

IF EXIST %loc% cscript \\server\Core-Software\WSH\wsh-update.vbs
===================

WSH-UPDATE.VBS
===================
'***********************************************************************
'
' Alfred Falk, ARC Information Systems, 2001-May-02.
' Determines version of WSH running on a machine and updates it as
' required
'
'**********************************************************************

Option Explicit

Const WSHver="5.6", LEver="5.6", Build=6914
Const updateloc = "\\Server\Core-Software\wsh\"

Dim WshShell
Set WshShell = CreateObject("WScript.Shell")

Dim needupgrade, LEcur, prog

LEcur = CStr(ScriptEngineMajorVersion()) & "." + CStr
(ScriptEngineMinorVersion())
'If (WScript.Version<WSHver) Then Wscript.Echo "upgrade needed for WSH
ver"
'If (LEcur<LEver) Then Wscript.Echo "upgrade needed for Language engine
ver"
'If (ScriptEngineBuildVersion()<Build) Then Wscript.Echo "upgrade needed
for Language engine Build"

needupgrade = (WScript.Version<WSHver) OR (LEcur<LEver) OR _
(ScriptEngineBuildVersion()<Build)

'WScript.Echo Cstr(needupgrade)

If needupgrade Then
' Which version of upgrade file depends on what OS we're running
If OsType()="W2K" Then
prog = "Script56_2k.exe"
Else
prog = "Script56_9xNt.exe"
End If
WshShell.Run updateloc & prog & " /q:a", 2
End If

Function OsType()
Const wntreg="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT
\CurrentVersion\CurrentVersion"
Const w9xreg="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
\CurrentVersion\Version"
Dim ov
On Error Resume Next
ov = WshShell.RegRead(w9xreg)
If Err.Number = 0 Then
OsType = "W98"
Else
ov = WshShell.RegRead(wntreg)
If ov = "5.0" Then
OsType = "W2K"
Else
OsType = "WNT"
End If
End If
On Error GoTo 0
End Function
===================
----------------------------------------------------------------
A L B E R T A Alfred Falk fa...@arc.ab.ca
R E S E A R C H Information Systems Dept (780)450-5185
C O U N C I L 250 Karl Clark Road
Edmonton, Alberta, Canada
http://www.arc.ab.ca/ T6N 1E4
http://www.arc.ab.ca/staff/falk/

Torgeir Bakken

unread,
Mar 26, 2002, 3:36:09 PM3/26/02
to
Alfred Falk wrote:

> This script ran successfully on a fresh WNT4 install, which has only IE
> 2.0.

I don't think so. You are running the WSH setup with the switch /q:a. This will
supress error messages.

If you remove the /q:a, you will on a NT 4.0 with IE 2.0 get this error:

------------------------------------------------------
Windows Script 5.6
------------------------------------------------------
Error registering the OCX V:\WINNT\System32\wshom.ocx
------------------------------------------------------
OK
------------------------------------------------------


and the WSH install is not complete.

--
torgeir


Alfred Falk

unread,
Mar 27, 2002, 2:01:39 PM3/27/02
to
Torgeir Bakken <Torgeir.B...@hydro.com> wrote in
news:3CA0DBB9...@hydro.com:

You are right. On the other hand, login script written in VBS runs
perfectly. I take it then that there are some things I can't do, but
I'm not touching them in my scripts, so I don't much care.

--

Alex K. Angelopoulos

unread,
Mar 27, 2002, 2:48:14 PM3/27/02
to
Umm... you're getting lucky somehow, then.

wshom.ocx contains references to the wscript.shell, wscript.network, and a few other core elements IIRC.

In any case, you may be able to force registering manually from a script later (assuming Wscript.Shell is functional) by running

regsvr32 wshom.ocx

"Alfred Falk" <fa...@arc.ab.ca> wrote in message news:Xns91DE7A58C9...@205.233.108.180...

0 new messages