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.
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
Write-host “Started on $(get-date); core service is $($x.status)”
#get cursor position
$saveY = [console]::CursorTop
$savex = [console]::CursorLeft
#Wait 60 seconds
start-sleep -s 60
#update service status
#place cursor and write the update
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 = “email@example.com”
$EmailTo = “ firstname.lastname@example.org ”
$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(“email@example.com ”, “password”);
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)