Thursday, April 23, 2015

Deploy SciLab 5.5.2

The SciLab x64 application deployment is fairly straight forward with the exception that it does not remove old versions when installing a new version. To complicate matters, the uninstall is done by calling an executable called unins000.exe in the Scilab-x.x.x folder in Program Files.

I created my PowerShell install script to search though the folders in Program Files, and if one of them matches Scilab, to go into that folder and run the uninstall command. This should work for future and past versions of Scilab 64-bit as long as the unins000.exe filename does not change. After uninstalling,  the script installs the new version.
# Remove old x64 versions.
$Softwares = Get-ChildItem -Path "$ENV:ProgramFiles" -Directory -Name
ForEach ($Software in $Softwares)
{
 if ($Software -match "sciLab")
 {
  Start-Process "$ENV:ProgramFiles\$Software\unins000.exe" -ArgumentList "/VERYSILENT" -wait
 }
}

# Install New Version
$arguments = "/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-"
Start-Process scilab-5.5.2_x64.exe -ArgumentList $arguments -wait

# Remove Desktop Shortcut for new version
if (Test-Path -Path "$ENV:SYSTEMDRIVE\Users\Public\Desktop\scilab-5.5.2 (64-bit).lnk")
{
 Remove-Item -Path "$ENV:SYSTEMDRIVE\Users\Public\Desktop\scilab-5.5.2 (64-bit).lnk" -Force -Recurse
}
 
Build your ConfigMgr package like normal, for the installation program, I use a command line like "powershell.exe -ExecutionPolicy Unrestricted -File install_scilab.ps1"
 
 
For the detection method I check the uninstall location of the registry like so:
 

 Edit: I forgot to mention, the SciLab installer appears to download two zip files when it is run. You can either just use the executable and the installer script in your source, or you can run the installer, download the two zips and package them in your source as well. If the zip's are already in the source, the executable does not have to go online and download and it speeds up the install. We've had success deploying it both ways. Here is what my source looks like:


 

2 comments:

  1. What version of PowerShell is this written for? I'm getting an error "parameter cannot be found matches parameter name 'Directory'" from line 2.

    ReplyDelete
    Replies
    1. Hello,
      I believe I wrote this using v4, and I just tested that line on v5 and it is working. I think the -directory parameter was added to get-childitem in powershell 3.0 along with -file.
      Try this, it should give you the directory names only:
      $Softwares = Get-ChildItem -Path "$ENV:ProgramFiles" | ?{$_.PSIsContainer} | Select-Object Name

      Delete