-
-
Save erwanclx/f1856a8bbb7a677873403a6bbff73162 to your computer and use it in GitHub Desktop.
Simple install script for latest version of RustDesk to point to your own server. Can be used in a GPO startup script.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Region Settings | |
| # IP address of our server | |
| $IpAddress = "127.0.0.1" | |
| # The public key for our server | |
| $PublicKeyString = "12345678" | |
| # The temporary folder where we will store and run the installer | |
| $TempFolder = "C:\Temp\" | |
| #EndRegion Settings | |
| #Check latest version of rustdesk | |
| $response = Invoke-WebRequest -Uri "https://api.github.com/repos/rustdesk/rustdesk/releases/latest" -UseBasicParsing | |
| $json = $response.Content | ConvertFrom-Json | |
| $ver = $json.tag_name | |
| # Check if RustDesk is already installed and exit if it is installed | |
| if ((Test-Path -Path "C:\Program Files\RustDesk\RustDesk.exe")) { | |
| "RustDesk already installed." | |
| exit 0 | |
| } | |
| # Create our temp folder if it doesn't exist | |
| if (!(Test-Path -Path $TempFolder)) { | |
| New-Item -ItemType Directory -Force -Path $TempFolder | |
| } | |
| # Change the current location to the temp folder | |
| Set-Location $TempFolder | |
| # Download last version of rustdesk | |
| Invoke-WebRequest -Uri "https://github.com/rustdesk/rustdesk/releases/download/$ver/rustdesk-$ver-windows_x64.zip" -Outfile rustdesk.zip | |
| # Extract the installer | |
| Expand-Archive rustdesk.zip | |
| # Change the current location to the rustdesk folder from the zip file | |
| Set-Location rustdesk | |
| # Rename the installer to configure the installer | |
| Rename-Item -Path .\rustdesk-$ver-putes.exe -NewName "rustdesk-host=$IpAddress,key=$PublicKeyString.exe" | |
| # Run the installer silently | |
| $Process = Start-Process -FilePath ".\rustdesk-host=$IpAddress,key=$PublicKeyString.exe" -ArgumentList "--silent-install" -PassThru -Verb runAs -Wait | |
| # Erase the installer and the zip file | |
| Remove-Item -Path $TempFolder\rustdesk -Recurse -Force | |
| Remove-Item -Path $TempFolder\rustdesk.zip -Recurse -Force | |
| # Exit with what ever exit code the installer returns | |
| exit $Process.ExitCode |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment