Home
Login Scripts
The base URL that you need to request in order to check in is: https://vigilance.erralert.com/v1/REPLACEthisWITHyourGUID
If you don't include anything after the GUID, then it will count as a check in, however the status won't be changed from the prior value. This also will not generate an email alert if the prior value contained one of the alert words (fail, warn, or error). You will still get an email alert if it doesn't check in within the required timeframe.
Generally you will check in and update the status together, the url for that is: https://vigilance.erralert.com/v1/REPLACEthisWITHyourGUID/Good
You can change the word 'Good' to anything you want, it is the Status value. Whatever you set it to will be shown in the dashboard, and be included in any alert emails.
If it contains 'warn', 'fail', or 'error' then an Alert will be emailed out,
even though the script checked in. An example would be 'warn - Low disk space', the email would contain this message so you know why the warning was generated. You can use this if the script has a result that needs attention.
It only needs to contain one of these, setting it to 'Script Popeye Warning' will trigger the alert since it contains 'warn'. The matching is case insensitive and can be anywhere in the status value. The maximum length of the field is 255 characters, if it is longer it will be shortened to 255 characters.
The HTTPS request will return one of three values, Success, Alert, or Failed.
Success: The report was successful.
Alert: Your reported status contained 'warn', 'fail', or 'error', and so an Email Alert was generated and sent out.
Failed: The request could not find the GUID you specified and so the report was not successful. Check your GUID and URL, one of those is likely wrong.";
Sample Scripts:
This page has several script examples. These methods may not be the most efficient, however they should be effective. If you have sample scripts you would like to include, pass them along.
Batch File / Command Prompt
powershell.exe -NonI -NoP -C "(Invoke-WebRequest -UseBasicParsing -Uri 'https://vigilance.erralert.com/v1/REPLACEthisWITHyourGUID/Good').Content"
Powershell
Powershell - $Result should contain 'Success', 'Alert', 'Failed', or when finished.
$Result = (Invoke-WebRequest -UseBasicParsing -Uri "https://vigilance.erralert.com/v1/REPLACEthisWITHyourGUID/Good").Content
Check a specific file's modified date, report if it is older than 3 hours or is missing.
$GUID = "REPLACEthisWITHyourGUID"
$Filename = "C:\Shares\MyFile.txt"
$Status = "Good"
if ( Test-Path $Filename ){
$ThisFileAge = [Math]::Round((New-TimeSpan (Get-ChildItem -Path $Filename).LastWriteTime).TotalMinutes, 3)
if ( $ThisFileAge -gt 180 ){ $Status = "Warning, the file '$($Filename)' has not been modified for $($ThisFileAge) minutes" }
}else{
$Status = "Warning, the file '$($Filename)' is missing!"
}
$Status = [uri]::EscapeDataString($Status)
$Result = (Invoke-WebRequest -UseBasicParsing -Uri "https://vigilance.erralert.com/v1/$($GUID)/$($Status)").Content
Write-Host "File status: $($Status) - Reporting status: $($Result) - Age: $($ThisFileAge) minutes - File: '$($Filename)'"
Check multiple file's modified date, report if any are older than x minutes (or if any file is missing). Also check if the drive that the files are on has less than X GB of free space, or if it is marked as not Healthy by Windows.
$GUID = "REPLACEthisWITHyourGUID"
$MaxAgeMinues = 1500 # 1440 minutes is 24 hours, so 1500 is 25 hours
$WarnIfFreeSpaceUnder = "50GB"
$CheckFiles = @()
$CheckFiles += "C:\Backup\App1\e\FileTime.txt"
$CheckFiles += "C:\Backup\App2\e\FileTime.txt"
$CheckFiles += "C:\Backup\Shares\Shared Data\FileTime.txt"
$Alerts = @()
$DrivesChecked = @()
$Status = "Good"
foreach ( $File in $CheckFiles ){
if ( $File.Substring(1,1) -eq ":" ){ #only check drives
$DriveLetter = $File.Substring(0,1)
if ( $DrivesChecked -notcontains $DriveLetter ){ #Only check this if this drive hasn't been checked before
$DrivesChecked += $DriveLetter
$Drive = Get-Volume -DriveLetter $DriveLetter
if ( ($Drive).SizeRemaining -lt $WarnIfFreeSpaceUnder ){
$DriveSpaceGB = [Math]::Round(($Drive).SizeRemaining / 1024 / 1024 / 1024, 2)
$Alerts += "Warning, the free space on drive '$($DriveLetter)' is $($DriveSpaceGB) GB."
}
if ( $Drive.HealthStatus -ne "Healthy" ){
$Alerts += "Warning, the Health on drive '$($DriveLetter)' is $($Drive.HealthStatus)."
}
}
}
if ( Test-Path $File ){
$ThisFileAge = [Math]::Round((New-TimeSpan (Get-ChildItem -Path $File).LastWriteTime).TotalMinutes, 3)
if ( $ThisFileAge -gt $MaxAgeMinues ){ $Alerts += "Warning, file '$($File)' has not changed for $($ThisFileAge) minutes" }
}else{
$Alerts += "Warning, file '$($File)' is missing"
}
}
if ( $Alerts.Length -gt 0 ){
foreach ( $Alert in $Alerts ){
Write-Host $Alert
$Status = [uri]::EscapeDataString($Alert)
$Result = (Invoke-WebRequest -UseBasicParsing -Uri "https://vigilance.erralert.com/v1/$($GUID)/$($Status)").Content
Write-Host "Reporting to Vigilance website response: $($Result)"
}
}else{
# No alerts!
$Result = (Invoke-WebRequest -UseBasicParsing -Uri "https://vigilance.erralert.com/v1/$($GUID)/Good").Content
Write-Host "Reporting to Vigilance website response: $($Result)"
}
Here is an example Scheduled Task to generate a text file and have it be updated every 5 minutes. Save it as an .xml file and import it into Scheduled Tasks. Change the user account to a user on your system (or set the user to 'Local System'), and the file path to what you need. This is a way to generate a file with a new timestamp in a folder which gets backed up, and then use the powershell scripts above to check the backups to make sure files are being backed up.
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2025-05-31T20:02:09.8864229</Date>
<Author>Admin</Author>
<URI>\Update FileTime</URI>
</RegistrationInfo>
<Triggers>
<CalendarTrigger>
<Repetition>
<Interval>PT5M</Interval>
<Duration>P1D</Duration>
<StopAtDurationEnd>false</StopAtDurationEnd>
</Repetition>
<StartBoundary>2025-05-31T00:01:12</StartBoundary>
<ExecutionTimeLimit>PT1M</ExecutionTimeLimit>
<Enabled>true</Enabled>
<ScheduleByDay>
<DaysInterval>1</DaysInterval>
</ScheduleByDay>
</CalendarTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<UserId>S-1-5-21-8948645656-46546565165156-111834317-2126</UserId>
<LogonType>S4U</LogonType>
<RunLevel>HighestAvailable</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>false</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>PT72H</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context="Author">
<Exec>
<Command>cmd.exe</Command>
<Arguments>/c time /t > c:\FolderFileTime.txt</Arguments>
</Exec>
</Actions>
</Task>
Ping one or more devices, alert if any go offline:
$PingList = @()
$PingList += "192.168.20.30"
$PingList += "192.168.20.31"
$PingList += "192.168.20.33"
$SuccessCount = 0
$FailureCount = 0
$SuccessList = @()
$FailedList = @()
$VigilanceGUID = "REPLACEthisWITHyourGUID"
$VigilanceStatus = "Good"
foreach ( $Item in $PingList ){
if ( $Item.trim().Length -gt 2 ){
$Result = Test-netConnection $Item -InformationLevel Quiet
if ( $Result ){
$SuccessCount++
$SuccessList += $Item
}else{
$FailureCount++
$FailedList += $Item
}
}
}
if ( $SuccessCount -gt 0 ){ Write-Host "Successful: $($SuccessList)" }
if ( $FailureCount -gt 0 ){ Write-Host "Failed: $($FailedList)"; $VigilanceStatus = "Failed - Camera Offline" }
Write-Host "Totals: Success=$($SuccessCount) Failed=$($FailureCount)"
$Result = (Invoke-WebRequest -UseBasicParsing -Uri "https://vigilance.erralert.com/v1/$($VigilanceGUID)/$($VigilanceStatus)").Content
Check the files in a folder to make sure there are enough and are the approximate right size
$GUID = "REPLACEthisWITHyourGUID"
$RequiredFileCount = 34
$MinimumFileSize = 1.5KB
$CombinedFileSize = 250MB
$Folder = "Z:\Backups\Test\$(Get-Date -Format "yyyy-MM-dd")"
$Status = "Good"
$ErrorCount = 0
$AllFiles = Get-ChildItem -Path $Folder
if ( $AllFiles.count -lt $RequiredFileCount ){ $ErrorCount++; $Status = "Warning, there should be $($RequiredFileCount) files, only $($AllFiles.count) were found." }
$TotalSize = 0
foreach ($Item in $AllFiles){
if ( $Item.Attributes -ne "Directory" ){
$TotalSize += $Item.Length
if ( $Item.Length -lt $MinimumFileSize ){
$Status = "Warning, File '$($Item.Name)' size $($Item.length) is under minimum size of $($MinimumFileSize)."
$ErrorCount++
}
}
}
if ( $TotalSize -lt $CombinedFileSize ){ $ErrorCount++; $Status = "Warning, the combined file size of $($TotalSize) is under the minimum of $($CombinedFileSize)" }
$StatusReport = [uri]::EscapeDataString($Status)
$Result = (Invoke-WebRequest -UseBasicParsing -Uri "https://vigilance.erralert.com/v1/$($GUID)/$($StatusReport)").Content
Write-Host "File status: $($Status) - Reporting status: $($Result)"
Task Scheduler XML File. Copy the following text and save it as a .xml file, then import it into Task Scheduler. You then need to change the username that it runs as and enter the password when you save it. This assumes that curl.exe is available on the computer.
If you call a Powershell script, you can call it using this format. This works in batch files and in Task Scheduler:
powershell.exe -windowstyle hidden -File "C:\Path\To\Script.ps1"
If you schedule this in Task Scheduler, in the Trigger, set it to 'One time', and then use 'Repeat task every' to have it run every so often. If you have it set to Daily, the 'Repeat task every' option may not work as expected. On the Settings tab, set "Stop the task if it runs longer than" to "1 minute".
If you get an error when starting the process in Task Scheduler, try changing the username to SYSTEM.