This PowerShell script creates a MySQL backup of the BlueCat IPControl database.
It runs mysqldump.exe, saves the export as a .sql file, compresses it into a .zip, and manages retention by deleting old backups.
Run in PowerShell with:
powershell.exe -ExecutionPolicy Bypass -File backup_ipcontrol.ps1-
Configurable parameters:
- Backup volume and path (
C:\temp) - MySQL bin path (
C:\Program Files\Diamond IP\InControl\mysql\bin) - Database user/password (
incadmin/incadminby default) - Base filename (
ipcontrol) - Retention time (default: 1209600 seconds = 14 days)
- Backup volume and path (
-
Ensures backup directory exists (
C:\tempby default). -
Deletes old backup files older than retention period.
-
Generates timestamped filenames:
ipcontrol-<timestamp>.sqlipcontrol-<timestamp>.logipcontrol-<timestamp>.zip
-
Runs mysqldump with options:
--opt --no-tablespaces
-
Compresses backup into
.zipfile.
.sqldump of theincontroldatabase..ziparchive containing the SQL dump..logfile with dump operation output.
All stored under the configured $path (default: C:\temp).
- Windows PowerShell
- MySQL client tools (
mysqldump.exe) in$mysqlPath - Permissions to access the
incontroldatabase with the given credentials
- Update
$userand$passwordvariables with valid DB credentials before running. - Default retention is 14 days; adjust
$keepFiles(in seconds) as needed. - Backups are stored locally; integrate with scheduled tasks or external storage for resilience.
This script is covered under the repository’s main MIT License.