I've created a PowerShell script that enables inspection of all the 'protected' Alerts in your Blue Iris database.
If the script detects issues with a protected Alert, it will also help you fix them so that the Alert will survive a Database Repair/Regenerate or Delete/Regenerate action.
This utility may be for you if you've ever experienced the following:
In addition to the core functions of finding and fixing protected Alerts that have issues, this script also has these features:
HOW TO GUIDE...
STEP #1:
Install the script and its companion 'user settings file'
Open PowerShell in Administrator mode, and type the following, then hit the Enter key:
(click here for a nice beginner's tutorial to using PowerShell).
STEP #2:
Edit the user settings file
STEP #3:
Use the script from the PowerShell console
Open an Admin PowerShell window, or Powershell-ISE window
3.1 - Select and copy the following command and paste it into the console.
Hit the Enter key.
(Be patient, it may take awhile for the script to respond if you have a lot of Alerts.)
The response should look like following two screenshots
This screenshot illustrates the first screen of output to the PowerShell Console.
Key features are highlighted.
The 'Flags' column shows if the Alert's database 'Flagged' and 'Protected' flags are set.
The 'RO' column shows if the read-only file attributes are set for the JPG and DAT files (if they exist)
This screenshot shows the result after hitting the keyboard spacebar until all results are displayed.
Additionally, it shows the timestamped output CSV file (displayed over the Console output).
Note that this file contains the details for those issues that have a 'Yes' column entry in the Console output.
When executed, the script creates the following folders.
It also creates the 'fixed_alerts_log.csv' if any Alerts have been 'fixed'.
The timestamped output CSV file is located here:
3.2 - Select and copy the following command and paste it into the console.
Hit the Enter key.
The response should look like following screenshot.
Note that the 'JpgExifMemo' column is now populated. Furthermore, the 'JpgExifMemo' column entry is 'match!' when the JPG Exif matches the 'AlertMemo' column entry. Otherwise the entry is actual JPG Exif value ('Title' tag).
For commands to 'fix' your protected Alerts that have issue, see post #2.
Finally, here's a screenshot of the script's help screen.
Script Zip File
EDIT (2024-03-23 3:40p): updated to v3
PLEASE NOTE: if you are updating, you must edit & use the new user-settings-file - tip: to facilitate editing, rename the existing file before unzipping the update.
If the script detects issues with a protected Alert, it will also help you fix them so that the Alert will survive a Database Repair/Regenerate or Delete/Regenerate action.
This utility may be for you if you've ever experienced the following:
- The loss of Alerts that you are certain you previously 'protected', and/or
- The loss of Alert memos that were automatically created by AI, or directly edited by you.
- The 'flag' protecting an Alert exists solely in the Blue Iris database and can be lost if the database is damaged or corrupted, and therefore must be regenerated.
- The Alert has has no JPG file (or DAT file).
- The Alert JPG file does not contain up-to-date Exif metadata .
- The Alert must have either a JPG file or a DAT file;
- At least one of these files (JPG or DAT) must have its 'read-only' file attribute set;
- The JPG file's Exif metadata must have up-to-date values, including a 'Title' property that matches the original database memo text.
In addition to the core functions of finding and fixing protected Alerts that have issues, this script also has these features:
- It saves timestamped results from each execution (to CSV files in the script's '\_output' subfolder), and supports auto-pruning of the old files from this folder.
- It logs all protected Alert fixes (to a CSV file name 'fixed_alerts_log.csv' in the script's root folder).
- It always performs a Blue Iris database Repair/Regenerate action if a missing JPG or DAT is fixed, or a JPG's Exif metadata is updated.
- It always backs up the Blue Iris database folder before performing a database Repair/Regenerate action (to the script's '\_backup_db_folders' subfolder)
- It always backs up original JPG file before changing the Exif metadata (to the script's '\_backup_jpgs' subfolder)
- It can log results to the Blue Iris logfile (optional)
- It can 'Flag' all protected Alerts in the Blue Iris database (Alert's with a 'Flag' state lose this designation with a database Delete/Regenerate action)
HOW TO GUIDE...
STEP #1:
Install the script and its companion 'user settings file'
- Extract all the files from the attached zip file to your desktop, or scripts folder.
- Please note that the folder used must be in your PC's environment path.
- Create a working folder for this script - it will be used to process the attachments files; to hold the script's log file, etc.
- To use the folder, you must edit a user setting
$app_path
in the user-settings script file (see STEP #2)
Open PowerShell in Administrator mode, and type the following, then hit the Enter key:
Set-ExecutionPolicy RemoteSigned
(click here for a nice beginner's tutorial to using PowerShell).
STEP #2:
Edit the user settings file
- The user settings file is named 'BI_alert_protect_user_settings.ps1'
- Open the file in a text editor (a code text editor is recommended; I use Notepad++)
- Edit the REQUIRED SETTINGS section (see screenshot)
- Ignore the remaining settings for now. They provide customizations that you may want to explore later.
STEP #3:
Use the script from the PowerShell console
Open an Admin PowerShell window, or Powershell-ISE window
3.1 - Select and copy the following command and paste it into the console.
BI_alert_protect.ps1 -NoInspect
Hit the Enter key.
(Be patient, it may take awhile for the script to respond if you have a lot of Alerts.)
The response should look like following two screenshots
This screenshot illustrates the first screen of output to the PowerShell Console.
Key features are highlighted.
The 'Flags' column shows if the Alert's database 'Flagged' and 'Protected' flags are set.
The 'RO' column shows if the read-only file attributes are set for the JPG and DAT files (if they exist)
This screenshot shows the result after hitting the keyboard spacebar until all results are displayed.
Additionally, it shows the timestamped output CSV file (displayed over the Console output).
Note that this file contains the details for those issues that have a 'Yes' column entry in the Console output.
When executed, the script creates the following folders.
It also creates the 'fixed_alerts_log.csv' if any Alerts have been 'fixed'.
The timestamped output CSV file is located here:
3.2 - Select and copy the following command and paste it into the console.
BI_alert_protect.ps1
Hit the Enter key.
The response should look like following screenshot.
Note that the 'JpgExifMemo' column is now populated. Furthermore, the 'JpgExifMemo' column entry is 'match!' when the JPG Exif matches the 'AlertMemo' column entry. Otherwise the entry is actual JPG Exif value ('Title' tag).
For commands to 'fix' your protected Alerts that have issue, see post #2.
Finally, here's a screenshot of the script's help screen.
Script Zip File
EDIT (2024-03-23 3:40p): updated to v3
PLEASE NOTE: if you are updating, you must edit & use the new user-settings-file - tip: to facilitate editing, rename the existing file before unzipping the update.
Attachments
Last edited: