Revert self-elevation changes
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
eb0d4aaaf9
commit
d0fa18f1c6
@@ -26,27 +26,6 @@ $rustdeskService = 'ScoutIT-RemoteSupport'
|
|||||||
function Install-RustDesk {
|
function Install-RustDesk {
|
||||||
$msiPath = "$env:SystemRoot\Temp\$rustdeskMsi"
|
$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
|
# Download
|
||||||
Write-Host "Downloading ScoutIT Remote Support client..."
|
Write-Host "Downloading ScoutIT Remote Support client..."
|
||||||
Try {
|
Try {
|
||||||
|
|||||||
@@ -9,26 +9,11 @@ $rustdeskService = 'ScoutIT-RemoteSupport'
|
|||||||
|
|
||||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||||
|
|
||||||
# ── Uninstall any existing version first (prevents MSI upgrade elevation failure) ─
|
# ── Check if already installed ────────────────────────────────────────────────
|
||||||
$uninstallKeys = @(
|
$svcCheck = Get-Service -Name $rustdeskService -ErrorAction SilentlyContinue
|
||||||
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*',
|
if ($null -ne $svcCheck) {
|
||||||
'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'
|
Write-Host "ScoutIT Remote Support is already installed. Exiting."
|
||||||
)
|
exit 0
|
||||||
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."
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# ── Download ──────────────────────────────────────────────────────────────────
|
# ── Download ──────────────────────────────────────────────────────────────────
|
||||||
|
|||||||
Reference in New Issue
Block a user