From c9de0f5a2c5988b5e82658d9882b786e06413ec1 Mon Sep 17 00:00:00 2001 From: dinger1986 Date: Thu, 4 Aug 2022 00:22:35 +0100 Subject: [PATCH 1/2] Update WindowsAgentAIOInstall.ps1 --- WindowsAgentAIOInstall.ps1 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/WindowsAgentAIOInstall.ps1 b/WindowsAgentAIOInstall.ps1 index 97e3f31..14f0a80 100644 --- a/WindowsAgentAIOInstall.ps1 +++ b/WindowsAgentAIOInstall.ps1 @@ -17,6 +17,23 @@ cd rustdesk start .\rustdesk-1.1.9-putes.exe --silent-install } +# Set URL Handler +New-Item -Path "HKLM:\SOFTWARE\Classes\RustDesk" +Set-ItemProperty -Path "HKLM:\SOFTWARE\Classes\RustDesk" -Name "(Default)" -Value "URL:RustDesk Protocol" +New-ItemProperty -Path "HKLM:\SOFTWARE\Classes\RustDesk" -Name "URL Protocol" -Type STRING +New-Item -Path "HKLM:\SOFTWARE\Classes\RustDesk\DefaultIcon" +Set-ItemProperty -Path "HKLM:\SOFTWARE\Classes\RustDesk\DefaultIcon" -Name "(Default)" -Value "RustDesk.exe,0" +New-Item -Path "HKLM:\SOFTWARE\Classes\RustDesk\shell" +New-Item -Path "HKLM:\SOFTWARE\Classes\RustDesk\shell\open" +New-Item -Path "HKLM:\SOFTWARE\Classes\RustDesk\shell\open\command" +Set-ItemProperty -Path "HKLM:\SOFTWARE\Classes\RustDesk\shell\open\command" -Name "(Default)" -Value '"\"C:\\Program Files\\RustDesk\\urlhandler.exe\" \"%1\""' +New-Item "C:\Program Files\RustDesk\urlhandler.ps1" +Set-Content "C:\Program Files\RustDesk\urlhandler.ps1" "`$url_handler = `$args[0`n`$rustdesk_id = `$url_handler -creplace '(?s)^.*\:',''`nStart-Process -NoNewWindow -FilePath 'C:\Program Files\RustDesk\rustdesk.exe' -ArgumentList '--connect `$rustdesk_id'" +Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force +Install-Module ps2exe -Force +Invoke-ps2exe "C:\Program Files\RustDesk\urlhandler.ps1" "C:\Program Files\RustDesk\urlhandler.exe" +Remove-Item "C:\Program Files\RustDesk\urlhandler.ps1" + # Write config If (!("C:\Windows\ServiceProfiles\LocalService\AppData\Roaming\RustDesk\config\RustDesk.toml")) { $username = ((Get-WMIObject -ClassName Win32_ComputerSystem).Username).Split('\')[1] From 526b0c24c35f9edff54f3d9eff5afc0d37573ff0 Mon Sep 17 00:00:00 2001 From: dinger1986 Date: Thu, 4 Aug 2022 23:56:17 +0100 Subject: [PATCH 2/2] Update WindowsAgentAIOInstall.ps1 --- WindowsAgentAIOInstall.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/WindowsAgentAIOInstall.ps1 b/WindowsAgentAIOInstall.ps1 index 14f0a80..d72bd44 100644 --- a/WindowsAgentAIOInstall.ps1 +++ b/WindowsAgentAIOInstall.ps1 @@ -26,12 +26,12 @@ Set-ItemProperty -Path "HKLM:\SOFTWARE\Classes\RustDesk\DefaultIcon" -Name "(Def New-Item -Path "HKLM:\SOFTWARE\Classes\RustDesk\shell" New-Item -Path "HKLM:\SOFTWARE\Classes\RustDesk\shell\open" New-Item -Path "HKLM:\SOFTWARE\Classes\RustDesk\shell\open\command" -Set-ItemProperty -Path "HKLM:\SOFTWARE\Classes\RustDesk\shell\open\command" -Name "(Default)" -Value '"\"C:\\Program Files\\RustDesk\\urlhandler.exe\" \"%1\""' +Set-ItemProperty -Path "HKLM:\SOFTWARE\Classes\RustDesk\shell\open\command" -Name "(Default)" -Value '"C:\Program Files\RustDesk\RustDeskURLLauncher.exe" "%1"' New-Item "C:\Program Files\RustDesk\urlhandler.ps1" -Set-Content "C:\Program Files\RustDesk\urlhandler.ps1" "`$url_handler = `$args[0`n`$rustdesk_id = `$url_handler -creplace '(?s)^.*\:',''`nStart-Process -NoNewWindow -FilePath 'C:\Program Files\RustDesk\rustdesk.exe' -ArgumentList '--connect `$rustdesk_id'" +Set-Content "C:\Program Files\RustDesk\urlhandler.ps1" "`$url_handler = `$args[0]`n`$rustdesk_id = `$url_handler -creplace '(?s)^.*\:',''`nStart-Process -FilePath 'C:\Program Files\RustDesk\rustdesk.exe' -ArgumentList ""--connect `$rustdesk_id""" Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force Install-Module ps2exe -Force -Invoke-ps2exe "C:\Program Files\RustDesk\urlhandler.ps1" "C:\Program Files\RustDesk\urlhandler.exe" +Invoke-ps2exe "C:\Program Files\RustDesk\urlhandler.ps1" "C:\Program Files\RustDesk\RustDeskURLLauncher.exe" Remove-Item "C:\Program Files\RustDesk\urlhandler.ps1" # Write config