Get-DbaEstimatedCompletionTime View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Monitors progress and estimated completion times for long-running SQL Server operations
Description Retrieves real-time progress information for long-running SQL Server maintenance and administrative operations by querying sys.dm_exec_requests. This function helps DBAs monitor the status of time-intensive tasks without having to guess when they’ll complete or manually check SQL Server Management Studio.
Shows progress details including percent complete, running time, estimated time remaining, and projected completion time.
Get-DbaQueryExecutionTime View Source Brandon Abshire, netnerds.net Windows, Linux, macOS Synopsis Retrieves stored procedures and SQL statements with the highest CPU execution times from SQL Server instances.
Description Analyzes SQL Server’s query execution statistics to identify performance bottlenecks by examining CPU worker time data from dynamic management views. This function queries sys.dm_exec_procedure_stats for stored procedures and sys.dm_exec_query_stats for ad hoc statements, returning detailed execution metrics including average execution time, total executions, and maximum execution time.
Get-DbaTopResourceUsage View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Identifies the most resource-intensive cached queries from sys.dm_exec_query_stats for performance troubleshooting
Description Analyzes cached query performance by examining sys.dm_exec_query_stats to find your worst-performing queries across four key metrics: total duration, execution frequency, IO operations, and CPU time. Each metric returns the top consumers (default 20) grouped by query hash, so you can quickly spot patterns in problematic queries that are dragging down server performance.
Invoke-DbaQuery View Source Friedrich Weinmann (@FredWeinmann) Windows, Linux, macOS 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.
New-DbaSqlParameter View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS 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. Supports all SqlParameter properties including output parameters, table-valued parameters, and column encryption for secure data handling.