mirror of
https://github.com/techahold/rustdeskinstall.git
synced 2025-08-08 08:01:30 +02:00
Fix for WindowsAgentAIOInstall.ps1
1. Added a check for the latest version of RustDesk. 2. Added a check to see if the latest version of RustDesk is installed and if yes, to skip right to update the configuration. 3. Fixed the script not adding the configuration because it was not waiting for the installation to complete. 4. Fixed ID and PW not displaying. 5. Added an option to close the script and open RustDesk automatically.
This commit is contained in:
parent
754c145b61
commit
9f77366eaa
@ -16,33 +16,61 @@ if (-Not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdenti
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Checks for the latest version of RustDesk
|
||||||
|
$url = 'https://www.github.com//rustdesk/rustdesk/releases/latest'
|
||||||
|
$request = [System.Net.WebRequest]::Create($url)
|
||||||
|
$response = $request.GetResponse()
|
||||||
|
$realTagUrl = $response.ResponseUri.OriginalString
|
||||||
|
$RDLATEST = $realTagUrl.split('/')[-1].Trim('v')
|
||||||
|
echo "RustDesk $RDLATEST is the latest version."
|
||||||
|
|
||||||
|
# Checks the version of RustDesk installed.
|
||||||
$rdver = ((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\RustDesk\").Version)
|
$rdver = ((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\RustDesk\").Version)
|
||||||
|
|
||||||
if($rdver -eq "1.2.2")
|
# Skips to inputting the configuration if the latest version of RustDesk is already installed.
|
||||||
{
|
if($rdver -eq "$RDLATEST") {
|
||||||
write-output "RustDesk $rdver is the newest version"
|
echo "RustDesk $rdver is already installed."
|
||||||
|
cd $env:ProgramFiles\RustDesk
|
||||||
|
echo "Inputting configuration now."
|
||||||
|
.\rustdesk.exe --config $rustdesk_cfg
|
||||||
|
.\rustdesk.exe --password $rustdesk_pw
|
||||||
|
$rustdesk_id = .\rustdesk.exe --get-id | Write-Output -OutVariable rustdesk_id
|
||||||
|
echo "All done! Please double check the Network settings tab in RustDesk."
|
||||||
|
echo ""
|
||||||
|
echo "..............................................."
|
||||||
|
# Show the value of the ID Variable
|
||||||
|
echo "RustDesk ID: $rustdesk_id"
|
||||||
|
|
||||||
|
# Show the value of the Password Variable
|
||||||
|
echo "Password: $rustdesk_pw"
|
||||||
|
echo "..............................................."
|
||||||
|
echo ""
|
||||||
|
echo "Press Enter to open RustDesk."
|
||||||
|
pause
|
||||||
|
.\rustdesk.exe
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
If (!(Test-Path C:\Temp)) {
|
if (!(Test-Path C:\Temp)) {
|
||||||
New-Item -ItemType Directory -Force -Path C:\Temp > null
|
New-Item -ItemType Directory -Force -Path C:\Temp > null
|
||||||
}
|
}
|
||||||
|
|
||||||
cd C:\Temp
|
cd C:\Temp
|
||||||
|
echo "Downloading RustDesk version $RDLATEST."
|
||||||
|
powershell Invoke-WebRequest "https://github.com/rustdesk/rustdesk/releases/download/$RDLATEST/rustdesk-$RDLATEST-x86_64.exe" -Outfile "rustdesk.exe"
|
||||||
|
echo "Installing RustDesk version $RDLATEST."
|
||||||
|
Start-Process .\rustdesk.exe --silent-install
|
||||||
|
Start-Sleep -Seconds 10
|
||||||
|
|
||||||
powershell Invoke-WebRequest "https://github.com/rustdesk/rustdesk/releases/download/1.2.6/rustdesk-1.2.6-x86_64.exe" -Outfile "rustdesk.exe"
|
$ServiceName = 'rustdesk'
|
||||||
Start-Process .\rustdesk.exe --silent-install -wait
|
|
||||||
|
|
||||||
$ServiceName = 'Rustdesk'
|
|
||||||
$arrService = Get-Service -Name $ServiceName -ErrorAction SilentlyContinue
|
$arrService = Get-Service -Name $ServiceName -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
if ($arrService -eq $null)
|
if ($arrService -eq $null)
|
||||||
{
|
{
|
||||||
Write-Output "Installing service"
|
echo "Installing service."
|
||||||
cd $env:ProgramFiles\RustDesk
|
cd $env:ProgramFiles\RustDesk
|
||||||
Start-Process .\rustdesk.exe --install-service -wait -Verbose
|
Start-Process .\rustdesk.exe --install-service -wait -Verbose
|
||||||
Start-Sleep -seconds 20
|
Start-Sleep -Seconds 20
|
||||||
}
|
}
|
||||||
|
|
||||||
while ($arrService.Status -ne 'Running')
|
while ($arrService.Status -ne 'Running')
|
||||||
@ -52,17 +80,25 @@ while ($arrService.Status -ne 'Running')
|
|||||||
$arrService.Refresh()
|
$arrService.Refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
cd $env:ProgramFiles\RustDesk\
|
# Waits for installation to complete before proceeding.
|
||||||
.\RustDesk.exe --get-id | Write-Output -OutVariable rustdesk_id
|
echo "Please wait a few seconds."
|
||||||
|
Start-Sleep -Seconds 10
|
||||||
|
|
||||||
.\RustDesk.exe --config $rustdesk_cfg
|
cd $env:ProgramFiles\RustDesk
|
||||||
|
echo "Inputting configuration now."
|
||||||
.\RustDesk.exe --password $rustdesk_pw
|
.\rustdesk.exe --config $rustdesk_cfg
|
||||||
|
.\rustdesk.exe --password $rustdesk_pw
|
||||||
Write-Output "..............................................."
|
$rustdesk_id = .\rustdesk.exe --get-id | Write-Output -OutVariable rustdesk_id
|
||||||
|
echo "All done! Please double check the Network settings tab in RustDesk."
|
||||||
|
echo ""
|
||||||
|
echo "..............................................."
|
||||||
# Show the value of the ID Variable
|
# Show the value of the ID Variable
|
||||||
Write-Output "RustDesk ID: $rustdesk_id"
|
echo "RustDesk ID: $rustdesk_id"
|
||||||
|
|
||||||
# Show the value of the Password Variable
|
# Show the value of the Password Variable
|
||||||
Write-Output "Password: $rustdesk_pw"
|
echo "Password: $rustdesk_pw"
|
||||||
Write-Output "..............................................."
|
echo "..............................................."
|
||||||
|
echo ""
|
||||||
|
echo "Press Enter to open RustDesk."
|
||||||
|
pause
|
||||||
|
.\rustdesk.exe
|
||||||
|
Loading…
x
Reference in New Issue
Block a user