I am deploying SparkLabs Viscosity version 1.10.2 either using exe or msi installer as an update on an older existing Viscosity installed on the endpoint, after being prompted to Close Programs, and about to execute the install I get this error message
Throw "Function failed, setting exit code [$returnCode
Please see the contents of Deploy-Application.ps1
[CmdletBinding()]
Param (
[Parameter(Mandatory=$false)]
[ValidateSet('Install','Uninstall','Repair')]
[string]$DeploymentType = 'Install',
[Parameter(Mandatory=$false)]
[ValidateSet('Interactive','Silent','NonInteractive')]
[string]$DeployMode = 'Interactive',
[Parameter(Mandatory=$false)]
[switch]$AllowRebootPassThru = $false,
[Parameter(Mandatory=$false)]
[switch]$TerminalServerMode = $false,
[Parameter(Mandatory=$false)]
[switch]$DisableLogging = $false
)
Try {
## Set the script execution policy for this process
Try { Set-ExecutionPolicy -ExecutionPolicy 'ByPass' -Scope 'Process' -Force -ErrorAction 'Stop' } Catch {}
##*===============================================
##* VARIABLE DECLARATION
##*===============================================
## Variables: Application
[string]$appVendor = 'SparkLabs'
[string]$appName = 'Viscosity'
[string]$appVersion = '1.10.2.1745'
[string]$appArch = ''
[string]$appLang = 'EN'
[string]$appRevision = '01'
[string]$appScriptVersion = '1.0.0'
[string]$appScriptDate = '05/15/2022'
[string]$appScriptAuthor = ''
##*===============================================
## Variables: Install Titles (Only set here to override defaults set by the toolkit)
[string]$installName = ''
[string]$installTitle = ''
##* Do not modify section below
#region DoNotModify
## Variables: Exit Code
[int32]$mainExitCode = 0
## Variables: Script
[string]$deployAppScriptFriendlyName = 'Deploy Application'
[version]$deployAppScriptVersion = [version]'3.8.4'
[string]$deployAppScriptDate = '26/01/2021'
[hashtable]$deployAppScriptParameters = $psBoundParameters
## Variables: Environment
If (Test-Path -LiteralPath 'variable:HostInvocation') { $InvocationInfo = $HostInvocation } Else { $InvocationInfo = $MyInvocation }
[string]$scriptDirectory = Split-Path -Path $InvocationInfo.MyCommand.Definition -Parent
## Dot source the required App Deploy Toolkit Functions
Try {
[string]$moduleAppDeployToolkitMain = "$scriptDirectory\AppDeployToolkit\AppDeployToolkitMain.ps1"
If (-not (Test-Path -LiteralPath $moduleAppDeployToolkitMain -PathType 'Leaf')) { Throw "Module does not exist at the specified location [$moduleAppDeployToolkitMain]." }
If ($DisableLogging) { . $moduleAppDeployToolkitMain -DisableLogging } Else { . $moduleAppDeployToolkitMain }
}
Catch {
If ($mainExitCode -eq 0){ [int32]$mainExitCode = 60008 }
Write-Error -Message "Module [$moduleAppDeployToolkitMain] failed to load: `n$($_.Exception.Message)`n `n$($_.InvocationInfo.PositionMessage)" -ErrorAction 'Continue'
## Exit the script, returning the exit code to SCCM
If (Test-Path -LiteralPath 'variable:HostInvocation') { $script:ExitCode = $mainExitCode; Exit } Else { Exit $mainExitCode }
}
#endregion
##* Do not modify section above
##*===============================================
##* END VARIABLE DECLARATION
##*===============================================
If ($deploymentType -ine 'Uninstall' -and $deploymentType -ine 'Repair') {
##*===============================================
##* PRE-INSTALLATION
##*===============================================
[string]$installPhase = 'Pre-Installation'
## Show Welcome Message, close viscosity, viscosityservice if required, allow up to 3 deferrals, verify there is enough disk space to complete the install, and persist the prompt
Show-InstallationWelcome -CloseApps 'viscosity,viscosityservice' -AllowDefer -DeferTimes 3 -CheckDiskSpace -PersistPrompt
## Show Progress Message (with the default message)
Show-InstallationProgress
## Show Progress Message (with the default message)
Show-InstallationProgress -StatusMessage "Installing Viscosity version 1.10.2. Please Wait...."
## <Perform Pre-Installation tasks here>
Start-Sleep -Seconds '20' #line used for testing
##*===============================================
##* INSTALLATION
##*===============================================
[string]$installPhase = 'Installation'
## <Perform Installation tasks here>
#install viscosity using exe installer
Execute-Process -Path "$dirFiles\viscosity-1.10.2.1745-2022-Profiles.exe" -Parameters "/silent /install /norestart"
##*===============================================
##* POST-INSTALLATION
##*===============================================
[string]$installPhase = 'Post-Installation'
## <Perform Post-Installation tasks here>
## Display a message at the end of the install
If (-not $useDefaultMsi) { Show-InstallationPrompt -Message 'Viscosity version 1.10.2.1745 installation is now completed. Click on OK to close this dialog box and re-open Viscosity app' -ButtonRightText 'OK' -Icon Information -NoWait }
}
ElseIf ($deploymentType -ieq 'Uninstall')
{
##*===============================================
##* PRE-UNINSTALLATION
##*===============================================
[string]$installPhase = 'Pre-Uninstallation'
## Show Welcome Message, close Viscosity with a 60 second countdown before automatically closing
#Show-InstallationWelcome -CloseApps 'Viscosity,viscosityservice' -CloseAppsCountdown 60
## Show Progress Message (with the default message)
#Show-InstallationProgress
## <Perform Pre-Uninstallation tasks here>
##*===============================================
##* UNINSTALLATION
##*===============================================
[string]$installPhase = 'Uninstallation'
## Handle Zero-Config MSI Uninstallations
#If ($useDefaultMsi) {
# [hashtable]$ExecuteDefaultMSISplat = @{ Action = 'Uninstall'; Path = $defaultMsiFile }; If ($defaultMstFile) { $ExecuteDefaultMSISplat.Add('Transform', $defaultMstFile) }
# Execute-MSI @ExecuteDefaultMSISplat
#}
# <Perform Uninstallation tasks here>
#Check if Viscosity is installed
$viscosity = 'C:\Program Files\Viscosity\ViscosityCC.exe'
If (test-path -Path $viscosity) {
#Ends Viscosity and Viscosity Service
& taskkill /im Viscosity.exe /f
& taskkill /im ViscosityService.exe /f
#Uninstall Viscosity
Execute-Process -Path "C:\Program Files\Viscosity\unins000.exe" -Parameters "/VERYSILENT"
}
##*===============================================
##* POST-UNINSTALLATION
##*===============================================
[string]$installPhase = 'Post-Uninstallation'
## <Perform Post-Uninstallation tasks here>
## Display a message at the end of the Uinstallation
#If (-not $useDefaultMsi) { Show-InstallationPrompt -Message 'Viscosity version 1.10.2.1745 Uninstallation is now completed. Click on OK to close this dialog box' -ButtonRightText 'OK' -Icon Information -NoWait }
}
ElseIf ($deploymentType -ieq 'Repair')
{
##*===============================================
##* PRE-REPAIR
##*===============================================
[string]$installPhase = 'Pre-Repair'
## Show Progress Message (with the default message)
Show-InstallationProgress
## <Perform Pre-Repair tasks here>
##*===============================================
##* REPAIR
##*===============================================
[string]$installPhase = 'Repair'
## Handle Zero-Config MSI Repairs
#If ($useDefaultMsi) {
# [hashtable]$ExecuteDefaultMSISplat = @{ Action = 'Repair'; Path = $defaultMsiFile; }; If ($defaultMstFile) { $ExecuteDefaultMSISplat.Add('Transform', $defaultMstFile) }
# Execute-MSI @ExecuteDefaultMSISplat
#}
# <Perform Repair tasks here>
Execute-Process -Path "$dirFiles\viscosity-1.10.2.1745-2022-Profiles.exe" -Parameters "/silent /install /norestart"
##*===============================================
##* POST-REPAIR
##*===============================================
[string]$installPhase = 'Post-Repair'
## <Perform Post-Repair tasks here>
}
##*===============================================
##* END SCRIPT BODY
##*===============================================
## Call the Exit-Script function to perform final cleanup operations
Exit-Script -ExitCode $mainExitCode
}
Catch {
[int32]$mainExitCode = 60001
[string]$mainErrorMessage = "$(Resolve-Error)"
Write-Log -Message $mainErrorMessage -Severity 3 -Source $deployAppScriptFriendlyName
Show-DialogBox -Text $mainErrorMessage -Icon 'Stop'
Exit-Script -ExitCode $mainExitCode
}
