-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDRMM-LiongardInstallMonitor.ps1
41 lines (36 loc) · 1.29 KB
/
DRMM-LiongardInstallMonitor.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
function write-DRMMAlert ($message) {
write-host '<-Start Result->'
write-host "Alert=$message"
write-host '<-End Result->'
}
function write-DRMMStatus ($message) {
write-host '<-Start Result->'
write-host "STATUS=$message"
write-host '<-End Result->'
}
function Write-DRMMDiagnostic ($message) {
write-host '<-Start Diagnostic->'
write-host $message
write-host '<-End Diagnostic->'
}
# Get Liongard site variables
$URL = $ENV:LiongardURL
$Key = $ENV:LiongardKey
$Secret = $ENV:LiongardSecret
$Environment = $ENV:LiongardEnvironment
# Confirm the presence of the site variables - if they don't exist kill script but don't fail to trigger the component reaction
if (!($URL) -or !($Key) -or !($Secret) -or !($Environment)) {
Write-DRMMAlert "ERROR: Variables not set on site in DRMM - failing."
Write-DRMMDiagnostic "!! Please refer to the onboarding guide for further information."
Exit 0
}
# Define the name of the Liongard agent service
$serviceName = 'roaragent.exe'
# Check if the service exists
if (Get-Service -Name $serviceName -ErrorAction SilentlyContinue) {
Write-DRMMStatus "Liongard installed."
} else {
Write-DRMMAlert "Liongard NOT installed."
Write-DRMMDiagnostic "Failure will trigger immediate instllation of Liongard agent"
Exit 1
}