From ec51f77ed15c514fb00f1054d40c1c6ad8593c30 Mon Sep 17 00:00:00 2001 From: Ivo Oskamp Date: Fri, 29 Nov 2024 11:19:08 +0100 Subject: [PATCH] Add Update rmm.ps1 --- Update rmm.ps1 | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Update rmm.ps1 diff --git a/Update rmm.ps1 b/Update rmm.ps1 new file mode 100644 index 0000000..6ebfe6f --- /dev/null +++ b/Update rmm.ps1 @@ -0,0 +1,45 @@ +# URL to the application's installer +$downloadUrl = "https://pinotage.centrastage.net/csm/profile/downloadAgent/key-site" +# Path where the installer will be saved +$downloadPath = "C:\Windows\Temp\agentsetup.exe" + +# Path to the uninstaller of the current application +$uninstallPath = "C:\Program Files (x86)\CentraStage\uninst.exe" +# Optional arguments for the uninstallation +$uninstallArgs = "/uninstall /quiet" + +# Optional arguments for the installation +$installArgs = "/silent" + +# Download the installer +Write-Output "Downloading the installer..." +Invoke-WebRequest -Uri $downloadUrl -OutFile $downloadPath + +Write-Output "The installer has been downloaded to $downloadPath." + +# Start the uninstallation +$uninstallProcess = Start-Process -FilePath $uninstallPath -ArgumentList $uninstallArgs -PassThru + +# Wait until the uninstallation is completed +Write-Output "Waiting for the uninstallation to complete..." +Wait-Process -Id $uninstallProcess.Id + +Write-Output "The uninstallation is complete." + +# Start the installation +$installProcess = Start-Process -FilePath $downloadPath -ArgumentList $installArgs -PassThru + +# Wait until the installation is completed +Write-Output "Waiting for the installation to complete..." +Wait-Process -Id $installProcess.Id + +Write-Output "The installation is complete." + +# Remove the downloaded installer +Write-Output "Removing the downloaded installer..." +Remove-Item -Path $downloadPath -Force + +Write-Output "The downloaded installer has been removed." + + +Write-Output "De installatie is voltooid."