Servers Alive Check type : external (errorlevel); alarm when errorlevel <> 0.
An example of a PS-script I use :
$RemoteServer=$args[0]
$RefValue=1
$Value=Invoke-Command -computername $RemoteServer -ScriptBlock
{(get-itemproperty "HKLM:\SOFTWARE\Microsoft\Microsoft Data Protection
Manager\Agent\2.0").Forcefixup}
if ($Waarde -eq $RefValue)
{
write-host "OK. Value ForceFixup is $Value. "
exit 0
}
else
{
write-host "Error. Value ForceFixup is $Value, must be $RefValue."
exit 1
}
The script checks if a registry-key still has value 1. If not it ends with an
errorlevel 1 and Servers Alive then generates an error.
Kind regards.
Pieter
From: Servers Alive Discussion List [mailto:[email protected]] On Behalf Of
Carroll, Andrew
Sent: dinsdag 6 december 2016 14:51
To: Servers Alive Discussion List
Subject: [SA-list] Powershell scripts for external checks.
Mailing List Users,
I have been away from Servers Alive external check development for some time
and the version of Servers Alive has moved on a fair bit since I was last doing
this sort of work.
I have had a quick look on the Servers Alive website for information regarding
using Powershell for external checks, as this is now my preferred scripting
language, but I’m not seeing much on the web site or the email list
archives.
Is anyone making much use of Powershell for their external checking processes,
would anyone be will to give me some ideas of the sort of stuff they are doing
and how you are wrapping Powershell scripts up so that they can be called from
within Servers Alive for performing external checks.
Regards,
Andy
Andy Carroll | Technical Support Analyst
Application Services | CGI
T: +44 1745-539109 | +44 7833-299741
[email protected] (mailto:[email protected]) | cgi-group.co.uk
CGI IT UK Limited. A CGI Group Inc. Company
Registered Office: 250 Brook Drive, Green Park, Reading RG2 6UA, United
Kingdom. Registered in England & Wales - Number 947968
CONFIDENTIALITY NOTICE: Proprietary/Confidential Information belonging to CGI
Group Inc. and its affiliates may be contained in this message. If you are not
a recipient indicated or intended in this message (or responsible for delivery
of this message to such person), or you think for any reason that this message
may have been addressed to you in error, you may not use or copy or deliver
this message to anyone else. In such case, you should destroy this message and
are asked to notify the sender by reply e-mail.
To unsubscribe send a message with UNSUBSCRIBE in the subject line to
[email protected] (mailto:[email protected])
If you use auto-responders (like out-of-the-office messages), make sure that
they are not sent to the list nor to individual members. Doing so will cause
you to be automatically removed from the list.
--------------------------------------------------------------------------------
Dit bericht wordt verzonden vanuit een e-mailadres voor professioneel gebruik.
De verantwoordelijken binnen de organisatie kunnen kennis nemen van alle
berichten verzonden naar dit adres.
Le présent message est envoyé d'une adresse e-mail pour usage
professionnel. Les responsables de l'organisation peuvent prendre connaissance
de tous les messages envoyés à cette adresse.
This message is sent from an e-mail address for professional use only. The
persons in charge of the organisation may take note of all messages sent to
this address.
To unsubscribe send a message with UNSUBSCRIBE in the subject line to
[email protected]
If you use auto-responders (like out-of-the-office messages), make sure that
they are not sent to the list nor to individual members. Doing so will cause
you to be automatically removed from the list.