Last active
July 28, 2023 10:06
-
-
Save phillip-haydon/639bbe66114f18b9fd340e4b20c2b66d to your computer and use it in GitHub Desktop.
Raygun Agent Update
This file contains 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
# UPDATE RAYGUN | |
# Create Temp Path | |
$tempPath = "C:\\automated-setup-temp\\" | |
If (!(Test-Path -Path $tempPath)) { | |
New-Item -Path $tempPath -ItemType Directory | |
} | |
# Configure where you want to download the installer | |
$installermsi = "C:\automated-setup-temp\RaygunAgent-x64.msi" | |
# 1. Download the installer | |
Write-Host("> Download Raygun Agent") | |
Invoke-WebRequest -Uri "https://downloads.raygun.com/APM/latest/RaygunAgent-x64.msi" -OutFile $installermsi | |
# Invoke-WebRequest -Uri "https://downloads.raygun.com/APM/builds/1.0.1132/Release/RaygunAgent-1.0.1132-x64.msi" -OutFile $installermsi | |
# 2. Run the Agent installer silently | |
Write-Host("> Install") | |
$args = "/i $installermsi","/quiet","/norestart","/L*V C:\RaygunAgentInstall.log" | |
$exitcode = (Start-Process -FilePath msiexec.exe -ArgumentList $args -Wait -Passthru).ExitCode | |
Write-Host("Installation completed with exit code: $exitcode") | |
if ($exitcode -ne 0) { | |
exit | |
} | |
# Find the latest version of Raygun Profiler | |
$latest_x86_profiler = (Get-ChildItem -Path 'C:\Program Files (x86)\Raygun\RaygunProfiler' | Where-Object {$_.Name -ne 'latest'} | Sort-Object -Property Name -Descending | Select-Object -First 1).FullName | |
$latest_profiler = (Get-ChildItem -Path 'C:\Program Files\Raygun\RaygunProfiler' | Where-Object {$_.Name -ne 'latest'} | Sort-Object -Property Name -Descending | Select-Object -First 1).FullName | |
# Create the symlink path | |
$latest_x86_link = 'C:\Program Files (x86)\Raygun\RaygunProfiler\latest' | |
$latest_link = 'C:\Program Files\Raygun\RaygunProfiler\latest' | |
# If the path exists then remove it | |
If (Test-Path -Path $latest_x86_link) { | |
Invoke-Expression "cmd /c rmdir ""$latest_x86_link""" | |
} | |
If (Test-Path -Path $latest_link) { | |
Invoke-Expression "cmd /c rmdir ""$latest_link""" | |
} | |
# Generate new symlink to latest profiler | |
Invoke-Expression "cmd /c mklink /d ""$latest_x86_link"" ""$latest_x86_profiler""" | |
Invoke-Expression "cmd /c mklink /d ""$latest_link"" ""$latest_profiler""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment