Skip to content

Instantly share code, notes, and snippets.

@matt40k
Last active February 14, 2016 09:28
Show Gist options
  • Save matt40k/32c9a655bc8c093bb315 to your computer and use it in GitHub Desktop.
Save matt40k/32c9a655bc8c093bb315 to your computer and use it in GitHub Desktop.
PreBuild script for SIMS bulk Import
# Capita installer url \ password
$url = [Environment]::GetEnvironmentVariable("sims_url")
$password = [Environment]::GetEnvironmentVariable("sims_pwd")
# Get SIMS Application installation directory
$simsAppDir = [Environment]::GetEnvironmentVariable("SIMSDOTNETDIRECTORY")
Write-Host 'SIMS Application Directory: '$simsAppDir
New-Item -ItemType Directory -Force -Path C:\TEMP
$tmpDir = "C:\TEMP"
$zipFile = $tmpDir+"\sims.zip"
$isoName = $url.Substring(36) -replace "zip", "iso"
$isoFile = $tmpDir+"\" + $isoName
# Download the .zip file
$r = Invoke-WebRequest $url -OutFile $tmpDir\sims.zip
# Unzip the ISO
& "C:\Program Files\7-Zip\7z.exe" e -o"$tmpDir" -y -tzip -p"$password" "$zipFile"
# Extract the installer from the ISO
& "C:\Program Files\7-Zip\7z.exe" e -o"$tmpDir" -y -tiso "$isoFile" Setups\Files\SIMSApplicationSetup.*
# Run the installer
& "$tmpDir\SIMSApplicationSetup.exe" "/S {QuietMode} [SIMSDotNetDirectory]='$simsAppDir' [SIMSDirectory]='c:\programdata\sims'" | Out-Null
if (Test-Path -Path $simsAppDir\Pulsar.exe) {
Write-Host 'SIMS .net application installed'
}
else {
Write-Host 'SIMS .net application NOT installed'
}
# Restore NuGet packages
& nuget restore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment