File tree Expand file tree Collapse file tree 2 files changed +4
-7
lines changed
Expand file tree Collapse file tree 2 files changed +4
-7
lines changed Original file line number Diff line number Diff line change 11
22$packageName = " ServiceControl"
33
4- $url = gci - path " c:\ChocolateyResourceCache" - Filter " Particular.ServiceControl -*.exe" - ErrorAction SilentlyContinue | select - first 1
4+ $url = gci - path " c:\ChocolateyResourceCache" - Filter " Particular.$packageName -*.exe" - ErrorAction SilentlyContinue| select - first 1
55
66if ($url ){
77 $url = $url | Select - expandProperty FullName
88}
99else {
10- $url = " https://github.com/Particular/$packageName /releases/download/{{ReleaseName}}/Particular.$packageName -{{FileVersion}}.exe"
10+ $url = " https://github.com/Particular/$packageName /releases/download/{{ReleaseName}}/Particular.$packageName -{{FileVersion}}.exe"
1111}
1212
1313
14-
1514try {
1615
1716 $existngService = Get-Service - Name " Particular.Management" - ErrorAction SilentlyContinue
2019 }
2120
2221 $chocTempDir = Join-Path $env: TEMP " chocolatey"
23-
2422 $tempDir = Join-Path $chocTempDir " $packageName "
25-
2623 if (! [System.IO.Directory ]::Exists($tempDir )) {[System.IO.Directory ]::CreateDirectory($tempDir ) | Out-Null }
2724 $file = Join-Path $tempDir " $ ( $packageName ) Install.exe"
2825 $logFile = Join-Path $tempDir " msiexe.log"
3532 $msiArguments = " /quiet /L*V `" $logFile `" "
3633 Write-Host " Starting installer with arguments: $msiArguments " ;
3734 Start-ChocolateyProcessAsAdmin " $msiArguments " $file - validExitCodes 0
38-
3935 Write-ChocolateySuccess $packageName
36+ Remove-Item $file - ErrorAction SilentlyContinue
4037} catch {
4138 Write-ChocolateyFailure $packageName $ ($_.Exception.Message )
4239 throw
Original file line number Diff line number Diff line change 11$productName = " ServiceControl" ;
22$version = " MajorMinorPatch" ;
33
4- $app = Get-WmiObject - Class Win32_Product | Where-Object { $_.Name -like " $productName *" -and ($_.Version -eq " $version " ) }
4+ $app = Get-WmiObject - Class Win32_Product | Where-Object { $_.Name -like " * $productName *" -and ($_.Version -eq " $version " ) }
55if ($app -eq $null )
66{
77 Write-Warning " Could not find an installed program for $productName matching version $version to uninstall. It may have been manualy removed. To check the cuurent status ensure that no instance of $productName exists in 'Programs and Features'."
You can’t perform that action at this time.
0 commit comments