We usually use something along this line to execute the powershell script command inside a ServersAlive check:
powershell -WindowStyle Hidden &'D:\Program Files (x86)\Woodstone\Servers Alive\external\serversalive_psscript.ps1' Regards, Parry From: Servers Alive Discussion List [mailto:salive@woodstone.nu] On Behalf Of Carroll, Andrew Sent: Wednesday, December 07, 2016 12:06 PM To: Servers Alive Discussion List Subject: RE: [SA-list] Powershell scripts for external checks. *** Exercise caution. This is an EXTERNAL email. DO NOT open attachments or click links from unknown senders or unexpected email. *** Pieter , That’s great, just the sort of stuff I was after a taking a look at. What is the batch script like that you call this from, or can you now call Powershell scripts directly from within Servers Alive? Regards, Andy From: Servers Alive Discussion List [mailto:salive@woodstone.nu (mailto:salive@woodstone.nu)] On Behalf Of Demeulemeester, Pieter Sent: 06 December 2016 14:46 To: Servers Alive Discussion List Subject: RE: [SA-list] Powershell scripts for external checks. 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:salive@woodstone.nu (mailto:salive@woodstone.nu)] 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 andrew.carr...@cgi.com (mailto:andrew.carr...@cgi.com) | 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 salive@woodstone.nu (mailto:salive@woodstone.nu) 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 salive@woodstone.nu (mailto:salive@woodstone.nu) 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. To unsubscribe send a message with UNSUBSCRIBE in the subject line to salive@woodstone.nu (mailto:salive@woodstone.nu) 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. To unsubscribe send a message with UNSUBSCRIBE in the subject line to salive@woodstone.nu 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.