PSBlitz is a PowerShell script that outputs SQL Server health and performance diagnostics data to Excel and saves execution plans and deadlock graphs as .sqlplan and .xdl files.


Since I’m a big fan of Brent Ozar’s SQL Server First Responder Kit, and I’ve found myself in many situations where I would have liked a quick way to easily export to Excel the output of sp_Blitz, sp_BlitzCache, sp_BlitzFirst, sp_BlitzIndex, sp_BlitzLock, and sp_BlitzWho, as well as saving to disk the execution plans identified by sp_BlitzCache and sp_BlitzWho together with deadlock graphs from sp_BlitzLock, I’ve decided to put together a PowerShell script that does just that.

The script itself relies on slightly modified versions of Brent’s stored procedures in order to make them portable (they’re no longer stored procedures, just stand-alone scripts)


Outputs the following to an Excel spreadsheet:

  • Wait stats – from sp_BlitzFirst
  • Currently running queries – from sp_BlitzWho
  • Instance health-related findings – from sp_Blitz
  • Index-related issues and recommendations – from sp_BlitzIndex
  • Top 10 most resource intensive queries – from sp_BlitzCache
  • Deadlock related information from the past 15 days – from sp_BlitzLock
  • Statistics details for a given database – when a database-specific check is requested
  • Index Fragmentation information for a given database – when a database-specific check is requested

sp_BlitzWho is called multiple times during the execution of PSBlitz in order to help get a better sense of what’s actively hitting the instance.

Exports the following files:

  • Execution plans (as .sqlplan files) – from the same data set generated by sp_BlitzCache
  • Execution plans (as .sqlplan files) – from the sample execution plans provided by sp_BlitzIndex @Mode = 0 and sp_BlitzIndex @Mode = 4 for missing index suggestions (only on SQL Server 2019)
  • Execution plans (as .sqlplan files) of currently running sessions – from the same data set generated by sp_BlitzWho
  • Deadlock graphs (as .xdl files) – from the same data set generated by sp_BlitzLock

By default, PSBlitz does a fast check which runs the following:

PSBlitz can also has in-depth check mode which runs:

If needed, you can run the checks against a specific database either by specifying the name of the database during the interactive execution or via the -CheckDB parameter.
The database-specific check will modify the executions of sp_Blitz, sp_BlitzCache, sp_BlitzIndex, and sp_BlitzLock as follows:

Running PSBlitz

PSBlitz can be ran in two ways:

  • as any PS script, by calling it either from its directory or using its full path, and providing parameters and values
PowerShell window:
PS C:\Users\Vlad> G:\PSBlitz\PSBlitz.ps1 LOCALHOST\VSQL19 -CheckDB StackOverflow
->Host LOCALHOST appears to be... up.
Testing connection to instance LOCALHOST\VSQL19...
->Connection to LOCALHOST\VSQL19 - Ok
Checking existence of database StackOverflow...
->Database StackOverflow - exists/is online
Executing a database-specific default check
  • in interactive mode by right clicking on the script and then clicking on “Run with PowerShell”, which will cause the script to prompt for input
PowerShell window:
Running in interactive mode
->Host LOCALHOST appears to be... up.
Name of the database you want to check (leave empty for all):
SQL login name (leave empty to use integrated security):
Perform an in-depth check?[Y/N]: Y
Testing connection to instance LOCALHOST\VSQL19...
->Connection to LOCALHOST\VSQL19 - Ok
Executing an instance-wide in-depth check in interactive mode

During execution, PSBlitz will tell you at which step it currently is, and, when it finishes, it will tell you where the output is saved and how long the execution took.

PSBlitz outputs SQL Server diagnostics data
PSBlitz execution against a SQL Server instance


When the script finishes you’ll have a folder in the same location as PSBlitz.ps1 containing an Excel file with the all the output generated and two sub-directories, one containing deadlock graphs and the other execution plans.

Output directory generated by PSBlitz
PSBlitz output directory

The excel file consists of multiple sheets, with the first sheet acting as an index for the rest of the report.

The rest of the sheets contain the output of the sp_Blitz scripts that you’re most likely already familiar with. The findings also include clickable hyperlinks that provide more explanations and solutions.

PSBlitz outputs SQL Server diagnostics data
sp_Blitz sheet
PSBlitz outputs SQL Server diagnostics data
sp_BlitzFirst sheet
PSBlitz outputs SQL Server diagnostics data
Wait Stats sheet

How I use it

I use PSBlitz mainly in three situations:

  • an instance is seeing sudden performance degradation that’s impacting overall response times in production, and I want to output as much performance diagnostics data as possible with minimal effort in order to start troubleshooting
  • I want to collect data to work with and also capture the “before” state of an instance when doing general performance tuning
  • I’m monitoring the effects of performance tuning efforts and any other changes that might impact SQL Server’s performance and reliability

Download and more info

For more info and updated versions check out the PSBlitz repository on GitHub.

Any input is welcome, but, since this is a personal project, I’ll address bugs, suggestions, and requests when my schedule allows it.

There is a dev branch, so If you want to make a contribution feel free to make a pull request to it.