Skip to content

Instantly share code, notes, and snippets.

@yohfee
Created July 19, 2023 05:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yohfee/9c4460f892ac333dbcdf8e359f1db68d to your computer and use it in GitHub Desktop.
Save yohfee/9c4460f892ac333dbcdf8e359f1db68d to your computer and use it in GitHub Desktop.
Install Mackerel Agent to Windows
param(
[parameter(mandatory=$true)][String]$ApiKey
)
$url = if ([System.Environment]::Is64BitOperatingSystem) {
"https://mackerel.io/file/agent/msi/mackerel-agent-x64-latest.msi"
} else {
"https://mackerel.io/file/agent/msi/mackerel-agent-latest.msi"
}
$file = [System.IO.Path]::GetTempFileName()
Invoke-WebRequest -Uri $url -OutFile $file
Start-Process -FilePath msiexec -Verb RunAs -ArgumentList "/qn /i $file APIKEY=$ApiKey"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment