Silent upgrade batch file for CATIA V5-6R2016

Warning: Scripting CATIA is so unreliable that I gave up using this script.  
This script should get you most of the way, but it still is buggy.
-------------------------------------------------------------------------------
Here is my silent upgrade batch file for CATIA V5-6R2016
This blog is going to wrap some lines and sometimes screw up the quotes, so double check all that.

@echo off
echo Install CATIA 2016 silently - (x64 bit Windows)
echo Based on the supported "Distributing the Software in Compressed Form" method.
REM Install CATIA and all Service packs on a clean PC and then zip them up.
REM - Ed Hammond 9.28.2016 Skills Inc. ed@skillsinc.com
REM - Copy this file to the local PC and run as Administrator
REM Set the variable for the UNC location on the server where the CATIA installers are stored 
set CATIAINSTALLERS=\\MYSERVER\FILE SHARE\CATIA\CATIA R2016
REM ---------------------------
REM -- Install Catia Base
REM start "" /wait "%CATIAINSTALLERS%\CATIA R2016\V5-6R2016.CATIA_P3.win_b64.1-1\CATIA_P3.win_b64\1\WIN64\startb.exe" -newdir -noreboot -all 
REM ---------------------------
REM -- Install VBA
REM msiexec /q /i "%CATIAINSTALLERS%\CATIA R2016\V5-6R2016.CATIA_P3.win_b64.1-1\CATIA_P3.win_b64\1\VBA\Vba71_x64.msi"
REM ---------------------------
REM -- Install Service Pack
REM start "" /wait "%CATIAINSTALLERS%\CATIA R2016\V5-6R2016.SP3.SPK.win_b64.1-1\SPK.win_b64\1\WIN64\startspkb.exe" -bC -killprocess
REM ****************** Now zip them up and put the zip file on your server: %CATIAINSTALLERS%\CATIA2016-for-SCCM.zip ********************
echo ---------------------------
C:
REM Zip up everything under %ProgramFiles%\Dassault Systemes\, Name the ZIP file CATIA2016-for-SCCM.zip and store the zip on the server.
echo Backing up CATSettings folder
echo ---------------------------
REM Backup CATSettings folder prior to upgrade. WARNING: Reusing these settings is against best practices. They should be re-created for each version.
start "" /wait robocopy "%APPDATA%\DassultSystemes\CATSettings" "%APPDATA%\DassultSystemes\CATSettings2015" /R:1
Echo Exporting CATSettings to XML file
echo ---------------------------
start "" /wait robocopy "%ProgramFiles%\Dassault Systemes\B25\win_b64\code\bin\CATBatGenXMLSet.exe"" "%APPDATA%\DassultSystemes\CATSettings" CATSettings-Export.xml
REM Optional: Use this Enviroment file line to change where the setting are stored: CATUserSettingPath=CSIDL_APPDATA\DassaultSystemes\CATSettings2015
echo Uninstall the old version
echo ---------------------------
if not exist "%ProgramFiles%\Dassault Systemes\B25\win_b64" to CLEAN
if exist "%temp%\Uninstall.bat" del "%temp%\Uninstall.bat"
start "" /wait robocopy "%ProgramFiles%\Dassault Systemes\B25\win_b64" "%temp%" Uninstall.bat /R:1

echo EXIT >> %temp%\Uninstall.bat
start "" /wait %temp%\Uninstall.bat
:CLEAN
echo Create the ENV Folders
echo ---------------------------
if not exist "%ProgramData%\DassaultSystemes\CATEnv" mkdir "%ProgramData%\DassaultSystemes\CATEnv"
if not exist "%APPDATA%\DassultSystemes\CATEnv" mkdir "%APPDATA%\DassultSystemes\CATEnv"
REM Extract Zip file to local PC
echo Use powershell to unzip the files to "%ProgramFiles%\Dassault Systemes\B26"
echo This can take 5 minutes, don't close this window!
echo ---------------------------
powershell.exe -nologo -noprofile -command "& { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::ExtractToDirectory('%CATIAINSTALLERS%\CATIA2016-for-SCCM.zip', '%ProgramFiles%'); }"
echo Now run all the CATIA tools that create the shortcuts and Prerequisites.
start "" /wait msiexec /i "%CATIAINSTALLERS%\V5-6R2016.CATIA_P3.win_b64.1-1\CATIA_P3.win_b64\1\WIN64\InstallDSSoftwarePrerequisites_x86_x64.msi" /q
start "" /wait msiexec /i "%CATIAINSTALLERS%\V5-6R2016.CATIA_P3.win_b64.1-1\CATIA_P3.win_b64\1\WIN64\InstallDSSoftwareVC11Prerequisites_x86_x64.msi" /q 
CD "%ProgramFiles%\Dassault Systemes\B26\win_b64\code\bin"
echo Running setcatenv
echo ---------------------------
REM For setcatenv help try setcatenv -h
REM For V5Regserver help try V5Regserver -h
REM Enviroment (-e) = CATIA_P3.V5-6R2016.B26
REM ProductLine (-cs) = CATIA_P3
setcatenv -p "%ProgramFiles%\Dassault Systemes\B26" -e CATIA_P3.V5-6R2016.B26 -d "%ProgramData%\DassaultSystemes\CATEnv" -a global -icon yes -menu yes -cs CATIA_P3
set DSY_NO_HKCU_REGISTRATION=TRUE
echo Running V5Regserver
echo ---------------------------
V5Regserver -set CATIA -env CATIA_P3.V5-6R2016.B26 -direnv "%ProgramData%\DassaultSystemes\CATEnv"
echo Running setcatenv for Tools
echo ---------------------------
setcatenv -tools -e CATIA_P3.V5-6R2016.B26 -cs CATIA_P3
echo Running VBA installer
echo ---------------------------
start "" /wait "%CATIAINSTALLERS%\V5-6R2016.CATIA_P3.win_b64.1-1\CATIA_P3.win_b64\1\VBA\DSVBA71Installer.exe" /install /norestart /q /log %temp%\DSVBA71.log
REM Create a license file (DSLicSrv.txt) that can be copied to the license folder and store it on the server
if not exist "%ProgramData%\DassaultSystemes\Licenses" mkdir "%ProgramData%\DassaultSystemes\Licenses"
copy "%CATIAINSTALLERS%\DSLicSrv.txt" %ProgramData%\DassaultSystemes\Licenses\ /y
echo Done! Don't forget to update you DSLS License Server!

Comments

Popular Posts