Scripted silent install of Visual Basic 6.0

I recently had a need to install Visual Basic 6.0 Enterprise Edition on a number of machines using a batch file script and a silent -unattended - installation process. Given the age of the application I thought this would be quite straightforward and well documented, but there were a number of hurdles to clear on the way so here is my solution.

First point of call was the Microsoft KnowledgeBase Article KB195828 titled HOW TO: Silently Install Visual Studio 6.0 Enterprise Edition. This sounded just what I needed. Unfortunately the version of Visual Basic (rather than Studio) I was installing did not have the Acost.exe application in the instructions. 

However the smsinst.exe installer in these instructions did exactly what I wanted anyway, when run manually. When it came to scripting it I found the executable exits immediately- this means that the script would continue to the next entry without waiting for the executable to finish. Even using the start /wait command which would usually resolve this did not work.

A bit of experimenting ,Googling , and referring further to the MS KnowledgeBase later I finished with the following script. The contents of CD1 had been copied to a network location accessible via a UNC path from the target machine. The serial number is given in the acmsetup line- the hyphen is removed from the serial number on the case, so in this example it would have been 123-4567890 on the sticker.

1REM Set the Installation source folder variable
2SET INSTDIR=\\UNC Path to Installation folder on network
3REM Run the registry patch which allows us to skip the first GUI section of the install
4REGEDIT /S "%INSTDIR%\key.dat"
5REM Run the VB Installer itself with the serial number
6START /WAIT %INSTDIR%\setup\acmsetup.exe 
7     /T VB98Ent.stf /S "%INSTDIR%\" /n"User Name" 
8     /o "Company name" /k 1234567890 
9     /b 1 /gc %TEMP%\vb6_install_log.txt /qtn

It is then necessary to reboot before applying the appropriate Service Pack.