Automatically installs or updates sp_WhoIsActive by Adam Machanic by downloading, extracting and installing sp_whoisactive.
Please consider donating to Adam if you find his stored procedure helpful.
To install sp_WhoIsActive to sqlserver2014a’s master database using Windows Authentication to login.
Install-DbaWhoIsActive -SqlServer sqlserver2014a -Database master
If no database is specified, you will be presented with a dialog box asking which database on sqlserver2014a you want to install the procedure within. If you’d like to use alternative credentials, specify the SqlCredential parameter.
Install-DbaWhoIsActive -SqlServer sqlserver2014a -SqlCredential (Get-Credential sqladmin)
You can also pipe servers from a variable such as $servers or from Get-DbaRegisteredServer
Get-DbaRegisteredServer -SqlInstance sqlserver | Install-DbaWhoIsActive -Database master