Redgate Monitor 14

Your first script

Develop your first PowerShell script from scratch.

Listing all clusters monitored by Redgate Monitor

1) Generate an authentication token. See the Authentication page for details.

2) Download the PowerShell Module. See Downloading the PowerShell Module page for details.

3) Extract the downloaded .zip file. Create an empty PowerShell file (e.g. "example.ps1") in the same directory where you extracted the PowerShell Module. Open it using a text editor.

4) Import the PowerShell module:

Import-Module .\RedgateMonitor

5) Next, you will need to connect Redgate Monitor with the authentication token (generated in Step 1) and the URL of the Redgate Monitor:

Connect-RedgateMonitor -ServerUrl 'http://myredgatemonitorserver:8080' -AuthToken 'GeneratedAuthenticationToken'

6) Fetch all clusters and print them to the console:

$servers = Get-RedgateMonitorMonitoredObject
foreach ($server in $servers)
{       
    Write-Output $server.Name
}

7) Save the file, open a new terminal in the same directory of your script, then execute it:

.\example.ps1

8) You will see the machines that are monitored by Redgate Monitor:


Didn't find what you were looking for?