Thursday, June 26, 2014

Deploy Maxima 5.31.2, (a Computer Algebra System) Silently with Active Setup

While working on a application package for deploying Maxima with SCCM 2012 recently, I found a perfect example of how to build a simple application deployment with Active Setup.

During this application build we are going to:
  1. Install Maxima silently.
  2. Disable ShowTips for each user using Active Setup.
  3. Remove the Firewall block prompt during first run. (I am allowing it through)
  4. Remove Desktop Icon if it exists.
Create a file called hkcumaxima.reg in your source directory. This file should contain:

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\wxMaxima]
"ShowTips"=dword:00000000


This file will be copied into the Maxima program folder during installation. It will be imported into the active setup registry location during logons.

Next create an install.cmd file with the following commands:

@echo off
cls


:Path
set loc=%~dp0


:Install
"%loc%maxima-5.31.2.exe"  /VERYSILENT /MERGETASKS=!desktopicon


REM ActiveSetup settings
REG ADD "HKLM\Software\Microsoft\Active Setup\Installed Components\HSU-Maxima" /v "StubPath" /t REG_SZ /d "CMD /C REG IMPORT \"%%ProgramFiles(x86)%%\Maxima-5.31.2\hkcumaxima.reg\"" /f
REG ADD "HKLM\Software\Microsoft\Active Setup\Installed Components\HSU-Maxima" /v "Version" /t REG_SZ /d "2,0,0,0" /f


REM Copy Files to Location
XCOPY "%loc%hkcumaxima.reg" "%ProgramFiles(x86)%\Maxima-5.31.2\" /Y


REM Allow program through Firewall
netsh advfirewall firewall add rule name="Enable Maxima" dir=in program="c:\program files (x86)\maxima-5.31.2\bin\xmaxima.exe" remoteip=localsubnet action=allow


:Cleanup
if exist "%PUBLIC%\Desktop\xMaxima.lnk" del "%PUBLIC%\Desktop\xMaxima.lnk"


:End

Put these 2 files along with the maxima executable into your source folder and call install.cmd to install.

Thursday, June 19, 2014

Deploy Minitab 17 via SCCM

Minitab has released a new version. Here is my method for packaging Minitab 17 for deployment via SCCM.
  1. I download the executable mtben1710.mu.exe from Minitab. When run this executable will extract all its files into a directory in C:\Windows. So I run this on a test computer and at the "Welcome to the Minitab 17 Setup" window, I stop and go to "C:\Windows\Downloaded Installations\Minitab 17 English MU" and copy the files to another directory or my Source on my SCCM Distribution point.
  2. When the Setup.exe from the unpacked Minitab setup folder is run, it will extract an MSI to C:\Windows\Installer with what appears to be a random name. I want this MSI. I can get the GUID from it for my detection method when I make it an application deployment in SCCM. So on my test machine, I run Setup and go through the whole process of installing Minitab. I then do a hardware inventory on the test machine and use Resource Explorer to find out what MSI installed Minitab 17. Looking at the Installed Software table under the entry for Minitab17 (not the entry for Minitab 17, don't ask me why its listed twice), I see that the local package that installed Minitab was C:\Windows\Installer\266403.msi. I copy this MSI to my Minitab 17 source folder. When I build the Application Deployment Type in SCCM, for my detection method I choose this MSI to get the GUID and version number. Alternatively you can dig around in this folder examining each MSI to find the right one.
  3. Now that you have the source files. Next you need to create a config.xml file. Open a command prompt in the directory with your source files and type "setup /admin" This will open the Minitab 17 Customization Tool. Here you will specify your license server, install options like whether to install the desktop icon, accept the EULA, make it a silent install and disable or enable the Software Update Manager. Create and save a config.xml to your source folder with the rest of the installation files.
  4.  Once you have created and saved your config.xml file, you need the command line for installation. The command line I use for installing Minitab 17 is simply: "setup.exe /config config.xml". My config.xml file takes care of the license server name, no desktop shortcut, accepts the EULA, disabled the Minitab update manager and installs silently.

Deploying without a license server

Ok so what about laptops or computers that may need to use Minitab without a license server, possibly because they wont be online when the user wants to use Minitab or maybe you don't have a license server.
Steps 1 and 2 are the same. At Step 3, enter localhost for the server name and save the new configuration file, possibly naming it config-standalone.xml if you already have config.xml for your license server settings in your source.
4. Next create a txt file called "MultiUserLicense.ini" with the following in it:
[Minitab 17.0]
License File=C:\Program Files (x86)\Minitab\Minitab 17\minitab.lic
Heartbeat=
Retries=
Put this file in your source, you are going to copy it to C:\ProgramData\Minitab\ during deployment. It tells Minitab where the license file is instead of prompting the user.
5. Now create a script to do all of this:
  1. Run the setup command with the appropriate switches
  2. Copy the minitab.lic file to the appropriate folder.
  3. Copy the MultiUserLicense.ini to the appropriate folder.
 I put the following code into a txt file called "install-standalone.cmd"
@ECHO OFF
:Location
Set loc=%~dp0
:Install
"%loc%Setup.exe" /config config-standalone.xml
:Copy License File
copy "%loc%minitab.lic" "C:\Program Files (x86)\Minitab\Minitab 17\minitab.lic"
copy "%loc%MultiUserLicense.ini" "C:\ProgramData\Minitab\MultiUserLicense.ini"
GOTO END
:END
Generally I package both of these into SCCM 2012 as 2 deployment types, the server license type is targeted to desktops, the stand alone is targeted to laptops.


Friday, June 13, 2014

Silently Deploy SPSS 22

While upgrading our deployments from SPSS 21 to SPSS 22 I noticed some changes in the SPSS 22 install. One, that the SPSS 22 .msi will now install the Microsoft Studio C++ 2008 redistributable itself, meaning that you no longer have to have this has a dependency for SPSS if you are using SCCM 2012 Application Deployment method and two, that Python is bundled with it.

This install script will:
  1. Silently Uninstall SPSS 19, 20 or 21 suppressing the reboot after uninstall.
  2. Silently Install SPSS 22 suppressing the reboot.
  3. Removes the 2 prompts for Firewall exception on first run. I block them, you can allow them by changing the script.
  4. Removes the encoding prompt on first run, defaulting to Unicode encoding.
  5. Licenses either with a license server or standalone depending on command used.
  6. Installs Python, integration plugin and extension commands for SPSS Statistics.

If you have the SPSS exe you will need to get the .msi file. You can get the .msi by double clicking the executable on a test machine and after it extracts and the InstallShield Wizard pops up you can browse to the temp folder created at %UserProfile%\AppData\Local\Temp\{somerandomstring} and move the msi somewhere else and cancel out of the wizard. Look for the folder most recently created.

I use the following cmd script to install SPSS 22.

@Echo off
CLS

:Path
Set loc=%~dp0

REM Uninstall SPSS 19
msiexec.exe /x {06C43FAA-7226-41EF-A05E-9AE0AA849FFE} /qn /norestart ALLUSERS=1 REMOVE="ALL"
REM Uninstall SPSS 20
msiexec.exe /x {2AF8017B-E503-408F-AACE-8A335452CAD2} /qn /norestart ALLUSERS=1 REMOVE="ALL"
REM Uninstall SPSS 21
msiexec.exe /x {1E26B9C2-ED08-4EEA-83C8-A786502B41E5} /qn /norestart ALLUSERS=1 REMOVE="ALL"


REM Installs SPSS22 with Network License
msiexec.exe /qn ALLUSERS=2 /m MSIDWWPE /norestart /i "%loc%IBM SPSS Statistics 22.msi" LICENSETYPE="Network" LSHOST="input your license server" DISABLE_COMMUTE="1" INSTALLPYTHON="1"

REM Config
netsh advfirewall firewall add rule name="Block SPSS Incoming" dir=in program="c:\program files\ibm\spss\statistics\22\stats.exe" remoteip=localsubnet action=block
netsh advfirewall firewall add rule name="Block Java Incoming" dir=in program="c:\program files\ibm\spss\statistics\22\JRE\bin\javaw.exe" remoteip=localsubnet action=block


REM Enable UUENCODING
reg add HKLM\Software\JavaSoft\Prefs\com\ibm\/S/P/S/S\/Statistics\22.0\ui\dialog_settings\welcome_page /v show_unicode_warning /d 1
reg add HKLM\Software\JavaSoft\Prefs\com\ibm\/S/P/S/S\/Statistics\22.0\ui\dialog_settings\welcome_page /v shown_unicode_warning /d 1



If you are using stand alone licenses, substitute the install line with:

msiexec.exe /q ALLUSERS=2 /m MSIUQUPQ /norestart /i "%loc%IBM SPSS Statistics 22.msi" AUTHCODE="input your license code" INSTALLPYTHON="1"

Place the Install Script with the MSI in the same folder and deploy with ConfigMgr.