Powershell Cmdlets

SQL Backup Master provides a comprehensive PowerShell module that allows you to automate and manage SQL Server backup operations programmatically. This module is designed to integrate with DevOps workflows, monitoring systems, and automated backup management scenarios.

Installation and Registration

Automatic Registration

  • During the SQL Backup Master installation process, the PowerShell cmdlet module is automatically registered:
  • The SQLBackupMaster.Cmdlet.dll assembly is placed in your SQL Backup Master installation directory
  • The installer automatically updates your PSModulePath environment variable to include this path
  • The module becomes available for import in all new PowerShell sessions

Manual Registration (If Needed)

If you need to manually register the cmdlets:

  • Import Module Directly: Import-Module "C:\Program Files\SQL Backup Master\SQLBackupMaster.Cmdlet.dll"
  • Verify Installation: Get-Command -Module SQLBackupMaster.Cmdlet
  • Check Module Path (if not working): $env:PSModulePath -split ';'

Prerequisites

  • License Requirement: PowerShell cmdlets require a Professional edition license or higher
  • Service Dependency: The SQL Backup Master service must be running before using any cmdlets
  • PowerShell Version: Requires PowerShell 5.1 or higher
  • .NET Framework: Requires .NET Framework 4.7.2 or higher

Available Cmdlets

The SQL Backup Master PowerShell module includes the following cmdlets:

Start-SqlBackupJob

Starts a SQL Server backup job with optional wait functionality and database filtering.

Get-SqlBackupJob

Retrieves information about configured backup jobs with filtering options.

Get-SqlBackupJobStatus

Gets the current status and execution details of a specific backup job.

Get-SqlBackupDestination

Retrieves destination configuration details for a backup job.

Get-SqlBackupVersion

Returns the version information of the SQL Backup Master cmdlet module.

Install-SqlBackupLicense

Installs a SQL Backup Master product license key.

Remove-SqlBackupLicense

Removes the current SQL Backup Master product license key.

Import-SqlBackupConfig

Imports a zipped file package, which must be produced by the SQL Backup Master export configuration function.

Get-SqlBackupSchedule

Retrieves scheduling information for one or all backup jobs.

Get-SqlBackupLog

Retrieves backup job log information.

Getting Help on Parameters

All SQL Backup Master cmdlets are self-documenting using PowerShell's built-in help system. To access detailed parameter information:

View Full Help

Get-Help Start-SqlBackupJob -Full Get-Help Get-SqlBackupJobStatus -Detailed

View Parameter Details Only

Get-Help Start-SqlBackupJob -Parameter * Get-Help Get-SqlBackupJob -Parameter NameFilter

Common Usage Patterns

Basic Job Execution

Start a backup job and return immediately (without awaiting completion)

Start-SqlBackupJob -JobName "MyDatabaseBackup"

Start and wait for completion

Start-SqlBackupJob -JobName "MyDatabaseBackup" -Wait

Start with specific backup type

Start-SqlBackupJob -JobName "MyDatabaseBackup" -BackupType Differential

Job Monitoring

Check job status

Get-SqlBackupJobStatus -JobName "MyDatabaseBackup"

List all jobs

Get-SqlBackupJob

List only enabled jobs

Get-SqlBackupJob -EnabledOnly

Pipeline Operations

Start multiple jobs

Get-SqlBackupJob -EnabledOnly | ForEach-Object { Start-SqlBackupJob -JobName $_.JobName }

Monitor job status for multiple jobs

Get-SqlBackupJob | Get-SqlBackupJobStatus

Error Handling

The cmdlets provide comprehensive error handling with detailed error information:

try { Start-SqlBackupJob -JobName "NonExistentJob" } catch { Write-Host "Error: $($_.Exception.Message)" Write-Host "Error ID: $($_.FullyQualifiedErrorId)" }

WhatIf Support

Cmdlets that perform operations support PowerShell's WhatIf functionality:

Preview what would happen without executing

Start-SqlBackupJob -JobName "MyDatabaseBackup" -Wait -WhatIf
Will produce output similar to the following, allowing you to preview the results
What if: Performing the operation "Start SQL Backup Job (Full) and wait for completion" on target "MyDatabaseBackup".

Require confirmation for destructive operations

Start-SqlBackupJob -JobName "MyDatabaseBackup" -Confirm

Verbose Output

Enable verbose output for detailed operation logging:

Start-SqlBackupJob -JobName "MyDatabaseBackup" -Verbose

Integration Examples

DevOps Pipeline Integration

Pre-deployment backup script

$result = Start-SqlBackupJob -JobName "Production_PreDeploy" -BackupType Full -Wait if ($result.Status -ne "Completed") { throw "Backup failed: $($result.Status)" }

Check all job statuses

$jobs = Get-SqlBackupJob -EnabledOnly foreach ($job in $jobs) { $status = Get-SqlBackupJobStatus -JobName $job.JobName if ($status.CurrentStatus -eq "Failed") { Write-Warning "Job $($job.JobName) has failed!" } }