Clear-DbaConnectionPool View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Clears all SQL Server connection pools on the specified computer to resolve connection issues.
Description Clears all SQL Server connection pools managed by the .NET SqlClient on the target computer. This forces any pooled connections to be discarded and recreated on the next connection attempt.
Connection pools can sometimes retain stale or problematic connections that cause intermittent connectivity issues, authentication failures, or performance problems.
Connect-DbaInstance View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Creates a persistent SQL Server Management Object (SMO) connection for database operations.
Description This command creates a reusable SQL Server Management Object (SMO) that serves as the foundation for most dbatools operations. Think of it as your entry point for connecting to SQL Server instances, whether on-premises, in Azure, or anywhere else.
The returned SMO server object handles authentication automatically, detecting whether to use Windows integrated security, SQL authentication, or Azure Active Directory based on your credentials.
Disconnect-DbaInstance View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Closes active SQL Server connections and removes them from the dbatools connection cache
Description Properly closes SQL Server connections created by dbatools commands like Connect-DbaInstance, preventing connection leaks and freeing up server connection limits. This function handles both SMO server objects and raw SqlConnection objects, ensuring clean disconnection and removing connections from the internal connection hash. Use this in scripts to explicitly manage connection lifecycle, especially when working with multiple instances or in long-running automation where connection limits matter.
Get-DbaConnectedInstance View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Returns SQL Server instances currently cached in the dbatools connection pool
Description Shows all SQL Server connections that are currently active or cached in your PowerShell session. When you connect to instances using dbatools commands like Connect-DbaInstance, those connections are stored in an internal cache for reuse. This command reveals what’s in that cache, including connection details like whether pooling is enabled and the connection type (SMO server objects vs raw SqlConnection objects).
Get-DbaConnection View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Returns a bunch of information from dm_exec_connections.
Description Returns a bunch of information from dm_exec_connections which, according to Microsoft:
“Returns information about the connections established to this instance of SQL Server and the details of each connection. Returns server wide connection information for SQL Server. Returns current database connection information for SQL Database.”
Syntax Get-DbaConnection [-SqlInstance] <DbaInstanceParameter[]> [[-SqlCredential] <PSCredential>] [-EnableException] [<CommonParameters>] Examples Example: 1 PS C:\> Get-DbaConnection -SqlInstance sql2016, sql2017 Returns client connection information from sql2016 and sql2017
Get-DbaFirewallRule View Source Andreas Jordan (@JordanOrdix), ordix.de Windows, Linux, macOS Synopsis Retrieves Windows firewall rules for SQL Server components from target computers for network troubleshooting and security auditing.
Description Retrieves Windows firewall rules for SQL Server components from target computers, helping DBAs troubleshoot connectivity issues and audit network security configurations. This command queries firewall rules for the SQL Server Engine, Browser service, and Dedicated Admin Connection (DAC) to identify which ports are open and what programs are allowed through the firewall.
Get-DbaNetworkConfiguration View Source Andreas Jordan (@JordanOrdix), ordix.de Windows, Linux, macOS Synopsis Retrieves SQL Server network protocols, TCP/IP settings, and SSL certificate configuration from SQL Server Configuration Manager
Description Collects comprehensive network configuration details for SQL Server instances, providing the same information visible in SQL Server Configuration Manager but in a scriptable PowerShell format. This function is essential for network connectivity troubleshooting, security audits, and compliance reporting across multiple SQL Server environments.
Get-DbaTcpPort View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Returns the TCP port used by the specified SQL Server.
Description By default, this function returns just the TCP port used by the specified SQL Server.
If -All is specified, the server name, IPAddress (ipv4 and ipv6), port number and an indicator of whether or not the port assignment is static are returned.
Remote sqlwmi is used by default.
New-DbaAzAccessToken View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Generates OAuth2 access tokens for Azure SQL Database and other Azure services authentication.
Description Creates OAuth2 access tokens for connecting to Azure SQL Database and other Azure services without storing passwords in scripts. Supports Managed Identity authentication from Azure VMs, Service Principal authentication for applications, and renewable tokens for long-running connections. The generated tokens can be used directly with Connect-DbaInstance and other dbatools commands to establish secure, modern authentication to Azure resources.
New-DbaConnectionString View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Creates connection strings for SQL Server instances using PowerShell-friendly parameters
Description Creates properly formatted SQL Server connection strings without having to manually construct complex connection string syntax. Instead of remembering obscure keywords like “Data Source” or “Initial Catalog”, you can use familiar PowerShell parameters like -SqlInstance and -Database.
This function handles the complexity of connection string building for you, including authentication methods (Windows, SQL Server, Azure AD), encryption settings, timeout values, and Azure SQL Database specifics.