How to automate installing the .Net Framework, iSeries and Oracle Client

I created a batch file that checks to see if the .net framework 3.5, 4.0, iSeries and Oracle Client is installed and if not install them.  I found it pretty useful, here’s the code:

@echo off
if not exist %windir%\\framework\v3.5 (
echo Copying installer for .Net 3.5
xcopy “\\somenetworklocation\dotNetInstallers\dotnetfx35.exe” c:\dotNetInstallers\ /c /r /y /q
echo Installing .Net 3.5
c:\dotNetInstallers\dotnetfx35.exe /qb /nopatch /norestart /lang:enu
) Else (
echo .Net 3.5 already installed, skipping

if not exist %windir%\\framework\v4.0.30319 (
echo Copying installer for .Net 4.0
xcopy “\\somenetworklocation\dotNetInstallers\dotNetFx40_Full_x86_x64.exe” c:\dotNetInstallers\ /c /r /y /q
echo Installing .Net 4.0
c:\dotNetInstallers\dotNetFx40_Full_x86_x64.exe /norestart /passive
) Else (
echo .Net 4.0 already installed, skipping

if exist c:\dotNetInstallers (
rmdir c:\dotNetInstallers /S /Q

if not exist C:\ORACLE\Base\product\11.1.0\client (
echo Copying Oracle 11g .Net Data Adapter
xcopy “\\somenetworklocation\Oracle 11g ODAC and Oracle Developer Tools for Visual Studio\*.*” C:\OraInst\ /E /C /H /R /Y /Q
echo Installing Oracle 11g .Net Data Adapter
setup.exe -responseFile C:\OraInst\OracleInstallPrefrencesNew.rsp
rem setup.exe -silent -responseFile C:\OraInst\OracleInstallPrefrencesNew.rsp
) Else (
echo Oracle 11.1.0 client already installed, skipping
if exist c:\OraInst (
rmdir c:\OraInst /S /Q

if not exist “C:\Program Files\IBM\Client Access\READMESP.TXT” (
echo Installing IBM iSeries Driver
“\\somenetworklocation\iSeries Access Install Image w all Options\setup.exe” -s
) Else (
echo IBM iSeries Driver already installed, skipping

echo Installation Complete
echo NOTE: you may need to restart for the changes to take effect.

Thanks to symantec’s forum for the inspiration for this one:

===== ORACLE NOTES =====

Automating Oracle’s install requires an ini file of sorts.  The easiest way to generate this file is to run the install on a machine with the settings you’re interested in, like so:
setup.exe -record -destinationFile C:\OraInst\rec.rsp
Once you have that file you can use it to install like so:

setup.exe -silent -responseFile C:\OraInst\custom.rsp

There are some gotcha’s with this, one of note is the -responseFile option would not work for me when the file path had a space in it, even if I used the standard double quote escaping.  So
setup.exe -silent -responseFile "C:\Oracle Install\custom.rsp

wouldn’t work.
Also you can’t move the installer after generating it, if you do you will get a “Invalid staging area” error.  What I did to get around this was create a folder for installing, like:
and generated the file there.  Then in the batch file copy the install from a network share to this local dir and then run setup.
Some more info on this is available on informit’s website here:

===== iSeries NOTES =====

Automating iSeries works much the same as automating Oracle.  It creates an ini file of sorts when you run this command:
setup -r -f1d:\dir\file.iss
note that the flag "-f1" actually runs into the file and folder path, in this case: "d:\dir\file.iss". More here:
To then install the app on subsequent machines run this:
setup -s -f1d:\dir\file.iss -f2d:\dir\file.log
-s indicates a silent install, -f1 is the ini file and -f2 is where the install logs messages to.  If you name the iss file this:
setup.iss, and put it in the same dir as the setup app you don’t have to provide the -f1 parm.  This is because the setup app will look for setup.iss automatically. More here:

  1. #1 by ibmas400 on September 9, 2011 - 6:46 pm


    thanks a lot for your instruction.

    • #2 by Anthony on September 13, 2011 - 3:15 pm

      You’re welcome!

  2. #3 by David on August 10, 2012 - 2:14 pm

    This is amazing. Thanks so much.

  3. #4 by David on August 10, 2012 - 2:22 pm

    I have a project that is similar but slightly different software. Is there a way to remotely check for older versions of oracle and then uninstall those before upgrading? Or do you know if a new oracle install can go over top. We are using ODAC and I know the response file setup is the same but I havent found much else on it. The other question is, when you do a silent install, is there a way to hide the status box window. I can hide the GUI installer but not the status cmd window.

    • #5 by Anthony on August 10, 2012 - 3:15 pm

      Wow, quite a few questions there! I’ll do my best to answer them, here goes:
      You can remotely check for ODAC versions, yes. There are a few ways I can think of to do this, the easiest being just remotely check if a particular file folder exists. ODAC uses its version in its file path. Another could be to check the registry / gac.
      You can install ODAC over top of itself, sometimes. There are many issues with this including it depends on how applications use it. COM uses a automatic upgrade type interface and some newer versions of ODAC will not be compatible with your programs, even though ODAC marked it compatible (boo oracle). Though I find recent versions work fine. So the answer is, it depends.
      I don’t believe there is any way to prevent the status box window from showing, however, you could try something tricky. If you ran the ODAC install as an administrator that is different from the currently logged on user they would not see anything happen. This is risky as they could be actively using something that depends on it and either their app, or the ODAC install could fail. Personally I found the ODAC install a tad buggy so I wouldn’t try anything like this though. I just don’t trust the thing.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: