Overview
SQL Backup Master v8.0 introduces a comprehensive set of PowerShell cmdlets that enable you to automate backup operations, manage licenses, retrieve job status, and integrate SQL Backup Master into your existing automation workflows.
The PowerShell module is automatically installed with SQL Backup Master and is immediately available for use in any PowerShell session. The installer configures the PSModulePath environment variable to include the module location, allowing you to import and use the cmdlets without any additional setup.
Getting Started
To begin using the SQL Backup Master cmdlets, open a PowerShell console and import the module:
Import-Module SQLBackupMaster
To view all available cmdlets in the module, use:
Get-Command -Module SQLBackupMaster
For detailed help on any cmdlet, use the Get-Help command:
Get-Help Start-SqlBackupJob -Detailed
Available Cmdlets
The SQL Backup Master module provides the following cmdlets for managing your backup operations:
Get-SqlBackupVersion
Retrieves the current version of SQL Backup Master installed on the system.
Get-SqlBackupVersion
Get-SqlBackupJob
Retrieves a list of all backup jobs configured in SQL Backup Master. You can filter jobs by name pattern or retrieve only enabled jobs.
Parameters:
-NameFilter: Filter jobs by name pattern (optional)-EnabledOnly: Include only enabled jobs (optional)
Examples:
# Get all backup jobs
Get-SqlBackupJob
# Get jobs matching a name pattern
Get-SqlBackupJob -NameFilter "Production"
# Get only enabled jobs
Get-SqlBackupJob -EnabledOnly
Get-SqlBackupJobStatus
Retrieves the current status of a specific backup job, including its current state, last run date, and next scheduled run.
Parameters:
-JobName: Name of the backup job to check (required)
Example:
Get-SqlBackupJobStatus -JobName "Production Databases"
Get-SqlBackupDestination
Retrieves information about all configured backup destinations for a specific job, including destination type, storage metrics, and configuration details.
Parameters:
-JobName: Name of the backup job (required)
Example:
Get-SqlBackupDestination -JobName "Production Databases"
Get-SqlBackupSchedule
Retrieves schedule information for backup jobs, including full, differential, and transaction log backup schedules.
Parameters:
-JobName: Name of specific backup job (optional)-ActiveOnly: Include only active schedules (optional)
Examples:
# Get all schedules
Get-SqlBackupSchedule
# Get schedule for a specific job
Get-SqlBackupSchedule -JobName "Production Databases"
# Get only active schedules
Get-SqlBackupSchedule -ActiveOnly
Get-SqlBackupLog
Retrieves backup log entries for a specific job within a date range. This cmdlet is useful for troubleshooting and monitoring backup operations.
Parameters:
-JobName: Name of the backup job (required)-StartDate: Start date for log retrieval (optional, defaults to 7 days ago)-EndDate: End date for log retrieval (optional, defaults to tomorrow)-MaxEntries: Maximum number of log entries to return (optional, defaults to 1000, max 10000)
Examples:
# Get logs for the last 7 days
Get-SqlBackupLog -JobName "Production Databases"
# Get logs for a specific date range
Get-SqlBackupLog -JobName "Production Databases" -StartDate "2025-01-01" -EndDate "2025-01-31"
# Limit the number of entries returned
Get-SqlBackupLog -JobName "Production Databases" -MaxEntries 500
Start-SqlBackupJob
Starts a backup job immediately. This cmdlet supports executing full, differential, or transaction log backups, and can optionally wait for job completion with progress reporting.
Parameters:
-JobName: Name of the backup job to start (required)-BackupType: Type of backup to perform - Full, Differential, or TransactionLog (optional, defaults to Full)-Wait: Wait for job completion and show progress (optional)-DatabaseNames: Override job configuration to backup only specific databases (optional)-WhatIf: Shows what would happen without actually executing the job-Confirm: Prompts for confirmation before executing
Examples:
# Start a full backup
Start-SqlBackupJob -JobName "Production Databases"
# Start a differential backup and wait for completion
Start-SqlBackupJob -JobName "Production Databases" -BackupType Differential -Wait
# Backup only specific databases
Start-SqlBackupJob -JobName "Production Databases" -DatabaseNames "Database1", "Database2"
# Preview what would happen without executing
Start-SqlBackupJob -JobName "Production Databases" -WhatIf
Import-SqlBackupConfig
Imports a backup configuration file into SQL Backup Master. You can choose to copy or move the configuration file during the import process.
Parameters:
-FilePath: Path to the backup configuration file to import (required)-Move: Use move semantics instead of copy semantics (optional)-WhatIf: Shows what would happen without actually importing-Confirm: Prompts for confirmation before importing
Examples:
# Import a configuration file
Import-SqlBackupConfig -FilePath "C:\Configs\backup-config.xml"
# Move the configuration file during import
Import-SqlBackupConfig -FilePath "C:\Configs\backup-config.xml" -Move
Install-SqlBackupLicense
Installs a license key for SQL Backup Master. The cmdlet validates the license before installation and requires a service restart to take effect.
Parameters:
-LicenseKey: License key to install (required)-WhatIf: Shows what would happen without actually installing-Confirm: Prompts for confirmation before installing
Example:
Install-SqlBackupLicense -LicenseKey "YOUR-LICENSE-KEY-HERE"
Note: You must restart the SQL Backup Master service for the license to take effect.
Remove-SqlBackupLicense
Removes the currently installed license from SQL Backup Master. This cmdlet requires a service restart to take effect.
Parameters:
-Force: Force removal without confirmation (optional)-WhatIf: Shows what would happen without actually removing-Confirm: Prompts for confirmation before removing
Examples:
# Remove license with confirmation
Remove-SqlBackupLicense
# Remove license without confirmation
Remove-SqlBackupLicense -Force
Note: You must restart the SQL Backup Master service for the change to take effect.
Common Usage Scenarios
Monitoring Backup Jobs
Use the cmdlets to monitor the status and health of your backup jobs:
# Check all enabled jobs and their status
Get-SqlBackupJob -EnabledOnly | ForEach-Object {
Get-SqlBackupJobStatus -JobName $_.JobName
}
Automating Backup Execution
Create custom backup automation scripts that integrate with your existing workflows:
# Start multiple jobs and wait for completion
@jobs = @("Production Databases", "Reporting Databases")
foreach (@job in @jobs) {
Start-SqlBackupJob -JobName @job -BackupType Full -Wait
}
Generating Reports
Extract backup information and create custom reports:
# Export job information to CSV
Get-SqlBackupJob | Select-Object JobName, IsEnabled, LastRunDate, LastRunOutcome |
Export-Csv -Path "BackupReport.csv" -NoTypeInformation
Pipeline Support
Many cmdlets support PowerShell pipeline operations for efficient data processing:
# Get all jobs and check their destinations
Get-SqlBackupJob | Get-SqlBackupDestination
# Start multiple jobs by name
"Job1", "Job2", "Job3" | Start-SqlBackupJob -BackupType Full
Best Practices
- Use the
-WhatIfparameter to preview changes before executing cmdlets that modify configuration - Leverage the
-Verboseparameter to get detailed information about cmdlet execution - Use the
-Waitparameter withStart-SqlBackupJobwhen you need to ensure a backup completes before continuing - Store PowerShell scripts in version control to maintain a history of your automation configurations
- Test automation scripts in a non-production environment before deploying to production systems
- Use error handling (try/catch blocks) in your scripts to manage failures gracefully
Requirements
- PowerShell 5.1 or later
- .NET Framework 4.7.2 or later
- SQL Backup Master v8.0 or later installed
- Appropriate permissions to manage SQL Backup Master operations
Additional Resources
For more information about PowerShell and SQL Backup Master, visit our comprehensive documentation or contact our support team for assistance with specific automation scenarios.