Wednesday, September 22, 2010

IBM DB2 Data Server Client 9.7 aka DB2 Connect Personal Edition

MSI based installation (IBM Data Server Client.msi) but controlled by a setup.exe which does various other things as well as calling the MSI.  No apparent way to control the MSI directly via a command line AND get a successful install.  Run Setup.exe /? to see the command line help. 

Run the setup manually to create a response file (does this during the interactive install) then use /u <response file> to do a silent install.

see http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=/com.ibm.db2.luw.qb.server.doc/doc/t0007299.html

"IBM Data Server Client.msi" which is the name of the MSI might look misleading.
http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=/com.ibm.swg.im.dbclient.install.doc/doc/r0011957.html
This page of the IBM Data Server Client discusses the setup accepting MSI command line parameters but this does not work with the DB2 Connect Personal Edition media referred to above. Confused I was.

Friday, September 17, 2010

Batch scripting

Using a batch script to determine if a process was still running.  Designed on Win7.

rem This code enables a controlled exit to properly report to the package installation process.
rem Dave Fanning

:: This is a batch file comment

SET TIMECMD=time /T

rem set start minute value
FOR /F "tokens=2 delims=:" %%A IN ('"%TIMECMD%"') DO SET STARTTIME=%%A
echo Waiting for cataloging to complete.
rem using ping to sleep
ping -n 2 127.0.0.1 > NUL

:CHECK

rem checking to see if db2.exe has finished running
FOR /F "usebackq tokens=2,3" %%C IN (`tasklist /FI "IMAGENAME eq db2.exe"`) DO SET DB2CHECK=%%C


IF %DB2CHECK%==No (GOTO:SUCCESS)


rem find time now
FOR /F "tokens=2 delims=:" %%B IN ('"%TIMECMD%"') DO SET TIMENOW=%%B

SET /A TIMEDIFF=%TIMENOW%-%STARTTIME%

rem check that the loop has been running less than 2 minutes
IF %TIMEDIFF% LSS 2 (GOTO:CHECK) ELSE (GOTO:TIMEOUT)


:TIMEOUT
rem the db2.exe did not finish operations within maximum 2 minutes.
rem end with the errorlevel 1
exit 1


:SUCCESS
rem OK the process terminated within 2 minutes
exit 0





This one just checks if the process is finished before continuing

rem wait for installer.exe to complete before moving the lnk file
:CHECK
rem waiting 20 secs
ping -n 20 127.0.0.1 > NUL
rem checking to see if installer.exe has finished running
FOR /F "usebackq tokens=2,3" %%C IN (`tasklist /FI "IMAGENAME eq installer.exe"`) DO SET INSTCHECK=%%C

IF NOT %INSTCHECK%==No (GOTO:CHECK)

Next command goes here.




A standard tasklist command to check for a partiular process could be

tasklist /FI "IMAGENAME eq Exc*"

this would return all process matching Exc* e.g. Excel.exe

Thursday, September 2, 2010

SQL Server 2008 client installation

This uses a setup.exe shell to control and coordinate the installation which is actually carried out be various MSIs.  Although it might be possible to engineer out the setup.exe and just use the MSIs I don't recommend it.  Microsoft have provided the capabilities to the setup.exe for it to be use for silent command line driven setups.  USE IT.

App-V is unlikely to be a good idea.  The SQL Server Configuration Manager - part of the Management Tools - uses an SQL WMI provider that it installs.  Attempting to virtualise this seems to cause an error which is unsurprising as the WMI does not get properly installed.  Also see this reason
https://support.microsoft.com/en-us/kb/2679533


Run through the interactive setup and select the features you want installed.  Note the location of the ConfigurationFile.ini that it creates.  You can use this later to configure the silent command line installation.
It's normally written to C:\Program Files\SQL Server 2008\100\Setup Bootstrap\Log\<timestamp>  Copy it from this location to the same folder as the setup.exe and modify as required.

Check out http://msdn.microsoft.com/en-us/library/ms144259.aspx (latest) https://msdn.microsoft.com/en-us/library/ms144259%28v=sql.105%29.aspx (2008R2) to see what changes you need to make to the ConfigurationFile.ini to make it silent etc.  Then run setup.exe /ConfigurationFile="<PathToFile>" to get the job done.

Wait you're not done yet. Get the latest service packs and updates from http://download.microsoft.com/ .  I dealt with the SP1.  You need to download and read the instructions about how to slipstream the update into the original media.  This is a good idea because it your install with be at the SP1 level in one hit.
Setup documentation.  This is useful but it is NON R2 specific.
http://go.microsoft.com/fwlink/?LinkID=229519&clcid=0x409

All versions SQL update center resource
https://technet.microsoft.com/en-us/library/ff803383.aspx

Finally, the Tools section of the Installation Center has an "Installed SQL features discovery report". You can use this to verify SP1 level of installation.  Pre SP1 is version 10.0.1600.22.  SP1 is version 10.1.2531.0  Installation times will vary depending on the features selected.  Expect around 30 mins for a client install.

Update - Blog to the rescue. 6 years later I have a very similar task to do.

2008 R2 SP3 download here.  Note there is NO IA64 version of this.  Only x86 and x64.  You can delete the platform subfolders e.g. x86, IA64 from the final media set to save space.
http://www.microsoft.com/en-us/download/details.aspx?id=44271

Not tested but it may be possible with separate installation configurationfile.ini settings to use the same admin point for both x86 and x64 installs.  If the x86 folder is retained and the SP3 slipstreamed in the same way then using the x86="True" setting in the configuration file could cause a x86 install on a x64 platform.


The setup.exe program automatically installs the platform appropriate components. 

First run an interactive setup from the original media to gernerate the ConfigurationFile.ini and save this off somewhere
Copy the original source to.
C:\SQLServer2008R2SP3FullClient
Extract out the Update
SQLServer2008R2SP3-KB2979597-x64-ENU.exe /x:c:\SQLServer2008R2SP3

Copy and overwrite c:\SQLServer2008R2SP3\setup.exe to C:\SQLServer2008R2SP3FullClient
Copy in the ConfigurationFile.ini
Lines to add edit:

IACCEPTSQLSERVERLICENSETERMS="true"
PCUSOURCE="c:\SQLServer2008R2SP3"            note here relative .\path is supported.
QUIETSIMPLE="true"                                            progress dialogs only
; UIMODE="Normal"                                              comment this line out

Copy THE FILES ONLY FROM c:\SQLServer2008R2SP3\x64\ to C:\SQLServer2008R2SP3FullClient\x64 BUT DO NOT INCLUDE microsoft.sql.chainer.packagedata.dll

The slipstream install point is now ready
run
setup.exe /configurationfile:C:\SQLServer2008R2SP3FullClient\ConfigurationFile.ini
and you are done.

If setup.exe is crashing you could have the wrong service pack files; 2008 instead of 2008 R2.

And here is your ultimate SQL Server what version do I have ? link
http://sqlserverbuilds.blogspot.co.uk/

There is also the SQL Server Management Studio (SSMS) which Microsoft makes available for free here https://msdn.microsoft.com/en-us/library/mt238290.aspx 
This is approximately a 700Mb download and installs many, but not all of the client features.  It is constantly updated.

Update 20/1/2017

The above slipstreaming can be used in a similar way with the SQL Server 2012 installation.  This installer is very similar to previous ones but is also able to retrieve and install updates from a WSUS server
https://technet.microsoft.com/en-us/library/ms143219%28v=sql.110%29.aspx
https://technet.microsoft.com/en-us/library/hh479746%28v=sql.110%29.aspx
https://msdn.microsoft.com/library/dd638062%28SQL.100%29.aspx#Slipstream

another 2008 specific page.
https://msdn.microsoft.com/library/dd638062%28SQL.100%29.aspx#Slipstream