Invoke-DbaBalanceDataFiles View Source Sander Stad (@sqlstad), sqlstad.nl Windows, Linux, macOS On this page: Synopsis · Description · Syntax · Examples · Parameters · Outputs Synopsis Re-balance data between data files
Description When you have a large database with a single data file and add another file, SQL Server will only use the new file until it’s about the same size.
You may want to balance the data between all the data files.
Invoke-DbaDbDecryptObject View Source Sander Stad (@sqlstad), sqlstad.nl Windows, Linux, macOS On this page: Synopsis · Description · Syntax · Examples · Parameters · Outputs Synopsis Decrypts encrypted stored procedures, functions, views, and triggers using Dedicated Admin Connection (DAC)
Description Recovers the original source code from encrypted database objects when the original scripts have been lost or are unavailable. This command uses the Dedicated Admin Connection (DAC) to access binary data from sys.
Invoke-DbaQuery View Source Friedrich Weinmann (@FredWeinmann) Windows, Linux, macOS On this page: Synopsis · Description · Syntax · Examples · Parameters · Outputs Synopsis Executes T-SQL queries, scripts, and stored procedures against SQL Server instances with parameterized query support
Description Executes T-SQL commands against one or more SQL Server instances, supporting queries from strings, files, URLs, or SQL Server Management Objects. This is the primary dbatools command for running custom SQL against your environment, whether you’re extracting data for reports, deploying scripts across multiple servers, or running maintenance commands.
Join-DbaPath View Source Friedrich Weinmann (@FredWeinmann) Windows, Linux, macOS On this page: Synopsis · Description · Syntax · Examples · Parameters · Outputs Synopsis Constructs file paths with correct separators for Windows and Linux SQL Server instances.
Description Constructs file paths by joining multiple segments while automatically using the correct path separators (backslash for Windows, forward slash for Linux) based on the target SQL Server instance’s operating system. This function eliminates the guesswork when building file paths for backup files, exports, scripts, or other SQL Server operations that need to reference files on the remote server.
New-DbaSqlParameter View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS On this page: Synopsis · Description · Syntax · Examples · Parameters · Outputs Synopsis Creates a SqlParameter object for use with parameterized queries and stored procedures.
Description Creates a Microsoft.Data.SqlClient.SqlParameter object with specified properties like data type, direction, size, and value. This is essential for executing parameterized queries and stored procedures safely through Invoke-DbaQuery, preventing SQL injection while providing precise control over parameter behavior.
Read-DbaTransactionLog View Source Stuart Moore (@napalmgram), stuart-moore.com Windows, Linux, macOS On this page: Synopsis · Description · Syntax · Examples · Parameters · Outputs Synopsis Retrieves raw transaction log records from a database using fn_dblog for forensic analysis and troubleshooting
Description Uses SQL Server’s built-in fn_dblog function to extract raw transaction log records from a live database, returning detailed information about every transaction in the format used by the SQL Server logging subsystem.
Repair-DbaInstanceName View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS On this page: Synopsis · Description · Syntax · Examples · Parameters · Outputs Synopsis Updates SQL Server’s @@SERVERNAME system variable to match the Windows hostname
Description Updates SQL Server’s @@SERVERNAME system variable to match the current Windows hostname, which is required after renaming a Windows server. This ensures proper functionality for Kerberos authentication and Availability Groups.
The function automatically detects the correct new server name and uses sp_dropserver and sp_addserver to update the SQL Server system tables.
Reset-DbaAdmin View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS On this page: Synopsis · Description · Syntax · Examples · Parameters · Outputs Synopsis Regains administrative access to SQL Server instances when passwords or access has been lost
Description Recovers access to SQL Server instances when you’re locked out due to forgotten passwords, disabled accounts, or authentication issues. This emergency recovery tool stops the SQL Server service and restarts it in single-user mode, allowing exclusive access to reset credentials and restore administrative privileges.
Resolve-DbaPath View Source Friedrich Weinmann (@FredWeinmann) Windows, Linux, macOS On this page: Synopsis · Description · Syntax · Examples · Parameters · Outputs Synopsis Validates and resolves file system paths with enhanced error handling and provider verification.
Description Validates and resolves file system paths with additional safety checks beyond PowerShell’s built-in Resolve-Path cmdlet. This function ensures paths exist and are accessible before performing database operations like backups, restores, or log file management.
Set-DbaMaxDop View Source Claudio Silva (@claudioessilva) Windows, Linux, macOS On this page: Synopsis · Description · Syntax · Examples · Parameters · Outputs Synopsis Configures SQL Server maximum degree of parallelism (MaxDOP) at instance or database level
Description Configures the max degree of parallelism setting to control how many processors SQL Server uses for parallel query execution. Without a specified value, the function automatically applies recommended settings based on your server’s hardware configuration using Test-DbaMaxDop.