Skip to content

Commit

Permalink
Always uninstall service before install/upgrade
Browse files Browse the repository at this point in the history
For #58
  • Loading branch information
bdukes committed Oct 23, 2024
1 parent d52ff5d commit 7bf1b5c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion automatic/rustdesk.install/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
$ErrorActionPreference = 'Stop';

$installedPath = 'C:\Program Files\RustDesk\RustDesk.exe';
if (Test-Path $installedPath) {
if (Get-Service -Name 'RustDesk' -ErrorAction SilentlyContinue) {
& $installedPath --uninstall-service;
}
}

$packageArgs = @{
packageName = $env:ChocolateyPackageName
fileType = 'exe'
Expand All @@ -12,7 +19,6 @@ $packageArgs = @{

Install-ChocolateyPackage @packageArgs;

$installedPath = 'C:\Program Files\RustDesk\RustDesk.exe';
if (Test-Path $installedPath) {
& $installedPath --install-service;
}

0 comments on commit 7bf1b5c

Please sign in to comment.