Occasionally, the Core Service may stop for environmental reasons. Users can check on the status of the Core Service and receive an email alert when the service stops by using pre-defined PowerShell scripts.
This script will check the status of the Core Service every minute. If the status is not set as “running”, users will receive an email stating that the Core Service is down. In the PowerShell console, users will receive a message showing when the script was launched and, on the following line, a status of the core service, which is updated every minute.
WARNING: All scripts provided in this article are meant to be used as examples and are not supported by AppAssure. Click here for more information on PowerShell support in AppAssure 5.
Please note that this script is meant to be used short-term only.
Before attempting to run the script, please make sure that the execution policy is set as remotesigned or less restrictive and that an elevated PowerShell Console is launched.
#CheckCoreService.ps1
Write-host “`r`n`r`nCore Service Survey`r`n____________________`r`n<CTRL-C> to Exit`r`n”
#get service status and write start message
$x=get-service appassurecore
Write-host “Started on $(get-date); core service is $($x.status)”
#get cursor position
$saveY = [console]::CursorTop
$savex = [console]::CursorLeft
Do
{
#Wait 60 seconds
start-sleep -s 60
#update service status
$x=get-service appassurecore
#place cursor and write the update
[console]::setcursorposition($savex, $savey)
Write-host “$(get-date)… Core Service is: $($x.status)”
}
while ($x.status -eq “Running”)
#exit the loop if status changed
#Send e-mail alert
$EmailFrom = “appassurecore@domain.com”
$EmailTo = “ admin@domain.com ”
$Subject = “Core Service Alert”
$Body = “$(get-date)… Core Service is: $($x.status)”
$SMTPServer = ” emailsvr.domain.com ”
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, portnumber)
$SMTPClient.EnableSsl = $true
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential(“admin@domain.com ”, “password”);
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)
© ALL RIGHTS RESERVED. Feedback Terms of Use Privacy