diff --git a/1-estudio-Install-TacticalRMM-and-RustDesk.ps1 b/1-estudio-Install-TacticalRMM-and-RustDesk.ps1 index faaa9ce..7792415 100644 --- a/1-estudio-Install-TacticalRMM-and-RustDesk.ps1 +++ b/1-estudio-Install-TacticalRMM-and-RustDesk.ps1 @@ -26,27 +26,6 @@ $rustdeskService = 'ScoutIT-RemoteSupport' function Install-RustDesk { $msiPath = "$env:SystemRoot\Temp\$rustdeskMsi" - # Uninstall any existing version first (prevents MSI upgrade elevation failure) - $uninstallKeys = @( - 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*', - 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*' - ) - foreach ($key in $uninstallKeys) { - Get-ItemProperty $key -ErrorAction SilentlyContinue | - Where-Object { $_.DisplayName -match 'ScoutIT-RemoteSupport|ScoutIT RemoteSupport|rustdesk' -or - $_.Publisher -match 'scoutit|rustdesk' } | - ForEach-Object { - $productCode = $_.PSChildName - Write-Host "Found existing install: $($_.DisplayName) [$productCode] - uninstalling..." - Stop-Service -Name $rustdeskService -Force -ErrorAction SilentlyContinue - Start-Process -FilePath "msiexec.exe" ` - -ArgumentList "/x `"$productCode`" /qn /norestart" ` - -Wait - Start-Sleep -Seconds 10 - Write-Host "Existing version removed." - } - } - # Download Write-Host "Downloading ScoutIT Remote Support client..." Try { diff --git a/2-estudio-Install-RustDesk-Standalone.ps1 b/2-estudio-Install-RustDesk-Standalone.ps1 index cc12129..de518a1 100644 --- a/2-estudio-Install-RustDesk-Standalone.ps1 +++ b/2-estudio-Install-RustDesk-Standalone.ps1 @@ -9,26 +9,11 @@ $rustdeskService = 'ScoutIT-RemoteSupport' [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -# ── Uninstall any existing version first (prevents MSI upgrade elevation failure) ─ -$uninstallKeys = @( - 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*', - 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*' -) -foreach ($key in $uninstallKeys) { - Get-ItemProperty $key -ErrorAction SilentlyContinue | - Where-Object { $_.DisplayName -match 'ScoutIT-RemoteSupport|ScoutIT RemoteSupport|rustdesk' -or - $_.Publisher -match 'scoutit|rustdesk' } | - ForEach-Object { - $productCode = $_.PSChildName - Write-Host "Found existing install: $($_.DisplayName) [$productCode] - uninstalling..." - # Stop the service first so MSI uninstall doesn't hang - Stop-Service -Name $rustdeskService -Force -ErrorAction SilentlyContinue - Start-Process -FilePath "msiexec.exe" ` - -ArgumentList "/x `"$productCode`" /qn /norestart" ` - -Wait - Start-Sleep -Seconds 10 - Write-Host "Existing version removed." - } +# ── Check if already installed ──────────────────────────────────────────────── +$svcCheck = Get-Service -Name $rustdeskService -ErrorAction SilentlyContinue +if ($null -ne $svcCheck) { + Write-Host "ScoutIT Remote Support is already installed. Exiting." + exit 0 } # ── Download ──────────────────────────────────────────────────────────────────