Downloading the PowerShell Module
Published 14 February 2023
Manual download
The PowerShell Module can be downloaded from the Configuration page in SQL Monitor:
Save the PowerShell Module in a convenient location.
Automatic download
The PowerShell Module can be downloaded automatically using the below script:
[Uri]$Global:MonitorUrl = 'https://your.sql.monitor.installation.com'
$WorkingDir = $PSScriptRoot
# Local paths for the downloaded module.
$ModuleZip = "$WorkingDir\RedgateSQM.zip"
$ModuleDir = "$WorkingDir\RedgateSQM"
# Remove any previously downloaded RedgateSQM module.
if (Test-Path $ModuleZip) { Remove-Item $ModuleZip }
if (Test-Path $ModuleDir) { Remove-Item $ModuleDir -Recurse -Force }
# Download and extract the RedgateSQM module.
Invoke-WebRequest -Uri "$($MonitorUrl.Scheme)://$($MonitorUrl.Authority)/Configuration/DownloadPowerShellModule/Download" -OutFile $ModuleZip
Expand-Archive -Path $ModuleZip -DestinationPath $WorkingDir
# Clean up previously downloaded RedgateSQM zip file.
Remove-Item $ModuleZip
