Tuesday, March 31, 2026

A powershell script to update rustdesk in action 1

For maintaining remote access for our IT systems we use a mix of action1 and rustdesk.  Though action1 has a very good remote web interface it can be slow at times.  I've setup a rustdesk server for additional security.  Below is a powershell script that I created.  

The script creates a folder for downloading rustdesk from github; and if it isn't there create it, download and install.  There is a else where if it is installed, uninstall rustdesk then create the install directory and install the latest version.


$Folder = 'c:\#NAMEOFFOLDER'

"Test to see if folder [$Folder]  exists"

if (Test-Path -Path $Folder) {

Remove-Item -Recurse -Force c:\#NAMEOFFOLDER\*.*

Remove-Item 'c:\#NAMEOFFOLDER'

Get-CimInstance -ClassName win32_product | Where-Object Name -Match "RustDesk" | 

    ForEach-Object -Process { 

        Invoke-CimMethod -InputObject $_ -Name Uninstall 

                            }

New-Item -Path "c:\" -Name "#NAMEOFFOLDER" -ItemType "directory"

Invoke-WebRequest https://github.com/rustdesk/rustdesk/releases/download/1.4.6/rustdesk-1.4.6-x86_64.msi -OutFile c:\saplit\rustdesk-1.4.0-x86_64.msi

$pkg = "c:\#NAMEOFFOLDER\rustdesk-1.4.0-x86_64.msi";

Start-Process msiexec "/i $pkg /norestart /qn" -Wait;

##Start-Process msiexec "/i $pkg /qn" -Wait;

##Start-Process msiexec "/i $pkg /norestart /qn" -Wait;

Start-Sleep -Seconds 30

Remove-Item -Recurse -Force c:\#NAMEOFFOLDER\*.*

Remove-Item 'c:\#NAMEOFFOLDER'


} else {

#uninstall rustdesk

Get-CimInstance -ClassName win32_product | Where-Object Name -Match "RustDesk" | 

    ForEach-Object -Process { 

        Invoke-CimMethod -InputObject $_ -Name Uninstall 

                            }

New-Item -Path "c:\" -Name "#NAMEOFFOLDER" -ItemType "directory"

Invoke-WebRequest https://github.com/rustdesk/rustdesk/releases/download/1.4.6/rustdesk-1.4.6-x86_64.msi -OutFile c:\saplit\rustdesk-1.4.0-x86_64.msi

$pkg = "c:\#NAMEOFFOLDER\rustdesk-1.4.0-x86_64.msi";

Start-Process msiexec "/i $pkg /norestart /qn" -Wait;

##Start-Process msiexec "/i $pkg /qn" -Wait;

##Start-Process msiexec "/i $pkg /norestart /qn" -Wait;

Start-Sleep -Seconds 30

Remove-Item -Recurse -Force c:\#NAMEOFFOLDER\*.*

Remove-Item 'c:\#NAMEOFFOLDER'

}

A powershell script to update rustdesk in action 1

For maintaining remote access for our IT systems we use a mix of action1 and rustdesk.  Though action1 has a very good remote web interface ...