Get-DbaDefaultPath View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Retrieves default file paths for SQL Server data, log, backup, and error log directories
Description Retrieves the default directory paths that SQL Server uses for new database files, transaction logs, backups, and error logs. This information is essential for capacity planning, automated database provisioning, and understanding where SQL Server will place files when no explicit path is specified. The function uses multiple fallback methods to determine these paths, including server properties, system queries, and examining existing system databases when standard properties are unavailable.
Get-DbaLastBackup View Source Klaas Vandenberghe (@PowerDBAKlaas) Windows, Linux, macOS Synopsis Retrieves last backup dates and times for database backup compliance monitoring
Description Queries msdb backup history to retrieve the most recent full, differential, and transaction log backup dates for each database. This function helps DBAs quickly identify backup gaps and verify compliance with backup policies by showing when each backup type was last performed. The function also calculates elapsed time since each backup and provides status indicators to highlight potential issues, such as databases with no recent backups or transaction log backups that are overdue in full recovery model databases.
Import-DbaBinaryFile View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Loads binary files from the filesystem into SQL Server database tables
Description Reads binary files from disk and stores them in SQL Server tables with binary, varbinary, or image columns. This is useful for storing documents, images, executables, or any file type directly in the database for archival, content management, or application integration scenarios.
The command automatically detects the appropriate columns for storing file data - it looks for binary-type columns (binary, varbinary, image) for the file contents and columns containing “name” for the filename.
Invoke-DbaAdvancedRestore View Source Stuart Moore (@napalmgram), stuart-moore.com Windows, Linux, macOS Synopsis Executes database restores from processed BackupHistory objects with advanced customization options
Description This is the final execution step in the dbatools restore pipeline. It takes pre-processed BackupHistory objects and performs the actual SQL Server database restoration with support for complex scenarios that aren’t handled by the standard Restore-DbaDatabase command.
The typical pipeline flow is: Get-DbaBackupInformation | Select-DbaBackupInformation | Format-DbaBackupInformation | Test-DbaBackupInformation | Invoke-DbaAdvancedRestore
Measure-DbaBackupThroughput View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Calculates backup throughput statistics from msdb backup history to analyze backup performance.
Description Analyzes backup history records from the msdb database to calculate detailed throughput statistics including average, minimum, and maximum backup speeds measured in megabytes per second. This function helps DBAs identify performance patterns, troubleshoot slow backups, and optimize backup strategies by examining historical backup performance data.
Read-DbaBackupHeader View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Extracts backup metadata from SQL Server backup files without restoring them
Description Uses SQL Server’s RESTORE HEADERONLY functionality to extract detailed metadata from backup files including database name, backup type, creation date, file lists, and backup size information. This lets you validate backups, plan restores, and audit backup inventory without actually performing a restore operation.
The function can process full, differential, and transaction log backups from local file systems, network shares, and Azure blob storage.
Remove-DbaBackup View Source Chris Sommer (@cjsommer), www.cjsommer.com Windows, Linux, macOS Synopsis Removes SQL Server backup files from disk based on retention policies and file extension criteria.
Description Recursively searches backup directories and removes SQL Server backup files older than your specified retention period. This function automates the tedious process of manually cleaning up old backup files to free disk space and maintain storage compliance.
You can target specific backup types by extension (.
Remove-DbaDbBackupRestoreHistory View Source IJeb Reitsma Windows, Linux, macOS Synopsis Removes backup and restore history records from MSDB database to prevent excessive growth
Description Removes backup and restore history records from MSDB database tables to prevent them from consuming excessive disk space and degrading performance. Over time, these history tables can grow substantially on busy SQL Server instances with frequent backup operations.
Works in two modes: server-level cleanup removes records older than a specified retention period (default 30 days), while database-level cleanup removes the complete backup/restore history for specific databases.
Restore-DbaDatabase View Source Stuart Moore (@napalmgram), stuart-moore.com Windows, Linux, macOS Synopsis Restores SQL Server databases from backup files with intelligent backup chain selection and point-in-time recovery.
Description Scans backup files and automatically selects the optimal restore sequence to recover databases to a specific point in time.
This function handles the complex task of building complete backup chains from full, differential, and transaction log backups,
so you don’t have to manually determine which files are needed or in what order to restore them.
Restore-DbaDbCertificate View Source Jess Pomfret (@jpomfret), jesspomfret.com Windows, Linux, macOS Synopsis Restores database certificates from .cer and .pvk files into SQL Server databases.
Description Restores database certificates and their associated private keys from backup files into SQL Server databases. This function is essential for recovering certificates used in TDE (Transparent Data Encryption), backup encryption, Always Encrypted, and other SQL Server security features after database migrations, disaster recovery, or server rebuilds.