Thor Logo dbatools

Install-DbaFirstResponderKit

View Source
Tara Kizer, Brent Ozar Unlimited (brentozar.com)
Windows, Linux, macOS

Synopsis

Downloads and installs Brent Ozar’s First Responder Kit diagnostic stored procedures.

Description

Downloads and installs the First Responder Kit (FRK), a collection of stored procedures designed for SQL Server health checks, performance analysis, and troubleshooting. The FRK includes essential procedures like sp_Blitz for overall health assessment, sp_BlitzCache for query performance analysis, sp_BlitzIndex for index recommendations, and sp_BlitzFirst for real-time performance monitoring.

This function automatically downloads the latest version from GitHub, caches it locally, and installs the procedures into your specified database. You can install the complete toolkit or select specific procedures based on your needs. The function handles version compatibility automatically, skipping procedures that aren’t supported on older SQL Server versions.

Perfect for DBAs who need standardized diagnostic tools across multiple SQL Server instances without manually downloading and deploying scripts.

First Responder Kit links:
http://FirstResponderKit.org
https://github.com/BrentOzarULTD/SQL-Server-First-Responder-Kit

Syntax

Install-DbaFirstResponderKit
    [-SqlInstance] <DbaInstanceParameter[]>
    [[-SqlCredential] <PSCredential>]
    [[-Branch] <String>]
    [[-Database] <Object>]
    [[-LocalFile] <String>]
    [[-OnlyScript] <String[]>]
    [-Force]
    [-EnableException]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Install-DbaFirstResponderKit -SqlInstance server1 -Database master

Logs into server1 with Windows authentication and then installs the FRK in the master database.

Example: 2
PS C:\> Install-DbaFirstResponderKit -SqlInstance server1\instance1 -Database DBA

Logs into server1\instance1 with Windows authentication and then installs the FRK in the DBA database.

Example: 3
PS C:\> Install-DbaFirstResponderKit -SqlInstance server1\instance1 -Database master -SqlCredential $cred

Logs into server1\instance1 with SQL authentication and then installs the FRK in the master database.

Example: 4
PS C:\> Install-DbaFirstResponderKit -SqlInstance sql2016\standardrtm, sql2016\sqlexpress, sql2014

Logs into sql2016\standardrtm, sql2016\sqlexpress and sql2014 with Windows authentication and then installs the FRK in the master database.

Example: 5
PS C:\> $servers = "sql2016\standardrtm", "sql2016\sqlexpress", "sql2014"
PS C:\> $servers | Install-DbaFirstResponderKit

Logs into sql2016\standardrtm, sql2016\sqlexpress and sql2014 with Windows authentication and then installs the FRK in the master database.

Example: 6
PS C:\> Install-DbaFirstResponderKit -SqlInstance sql2016 -Branch dev

Installs the dev branch version of the FRK in the master database on sql2016 instance.

Example: 7
PS C:\> Install-DbaFirstResponderKit -SqlInstance sql2016 -OnlyScript sp_Blitz.sql, sp_BlitzWho.sql, SqlServerVersions.sql

Installs only the procedures sp_Blitz and sp_BlitzWho and the table SqlServerVersions by running the corresponding scripts.

Example: 8
PS C:\> Install-DbaFirstResponderKit -SqlInstance sql2016 -OnlyScript Install-All-Scripts.sql

Installs the First Responder Kit using the official install script.

Example: 9
PS C:\> Install-DbaFirstResponderKit -SqlInstance sql-server-001.database.windows.net -OnlyScript Install-Azure.sql

Installs the First Responder Kit using the official install script for Azure SQL Database.

Example: 10
PS C:\> Install-DbaFirstResponderKit -SqlInstance sql2016 -OnlyScript Uninstall.sql

Uninstalls the First Responder Kit by running the official uninstall script.

Required Parameters

-SqlInstance

The target SQL Server instance or instances.

PropertyValue
Alias
RequiredTrue
Pipelinetrue (ByValue)
Default Value

Optional Parameters

-SqlCredential

Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.
For MFA support, please use Connect-DbaInstance.

PropertyValue
Alias
RequiredFalse
Pipelinefalse
Default Value
-Branch

Specifies which GitHub branch of the First Responder Kit to download and install. Defaults to ‘main’ for the stable release.
Use ‘dev’ to install the development branch when you need the latest features or bug fixes that haven’t been released yet.

PropertyValue
Alias
RequiredFalse
Pipelinefalse
Default Valuemain
Accepted Valuesmain,dev
-Database

Specifies the target database where the First Responder Kit stored procedures will be installed. Defaults to master.
Consider using a dedicated DBA or utility database instead of master for better organization and maintenance.

PropertyValue
Alias
RequiredFalse
Pipelinefalse
Default Valuemaster
-LocalFile

Specifies the path to a local zip file containing the First Responder Kit scripts instead of downloading from GitHub.
Use this when you have a specific version cached locally, when internet access is restricted, or when you need to install a customized version of the toolkit.

PropertyValue
Alias
RequiredFalse
Pipelinefalse
Default Value
-OnlyScript

Specifies specific script files to install instead of the entire First Responder Kit. Accepts multiple script names and wildcards.
Use this to install only the procedures you need (like sp_Blitz.sql, sp_BlitzCache.sql) or to run official install scripts (Install-All-Scripts.sql, Install-Azure.sql). Also supports Uninstall.sql to
remove the toolkit.

PropertyValue
Alias
RequiredFalse
Pipelinefalse
Default Value
Accepted ValuesInstall-All-Scripts.sql,Install-Azure.sql,sp_Blitz.sql,sp_BlitzFirst.sql,sp_BlitzIndex.sql,sp_BlitzCache.sql,sp_BlitzWho.sql,sp_BlitzAnalysis.sql,sp_BlitzBackups.sql,sp_BlitzLock.sql,sp_DatabaseRestore.sql,sp_ineachdb.sql,SqlServerVersions.sql,Uninstall.sql
-Force

Forces a fresh download of the First Responder Kit from GitHub even if a cached version already exists locally.
Use this when you want to ensure you have the absolute latest version or when the cached version may be corrupted.

PropertyValue
Alias
RequiredFalse
Pipelinefalse
Default ValueFalse
-EnableException

By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with “sea of red” exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this “nice by default” feature off and enables you to catch exceptions with your own try/catch.

PropertyValue
Alias
RequiredFalse
Pipelinefalse
Default ValueFalse
-WhatIf

Shows what would happen if the command were to run. No actions are actually performed.

PropertyValue
Aliaswi
RequiredFalse
Pipelinefalse
Default Value
-Confirm

Prompts to confirm actions

PropertyValue
Aliascf
RequiredFalse
Pipelinefalse
Default Value