commands

^

Install-DbaWhoIsActive

Author Chrissy LeMaire (@cl), netnerds.net
Availability Windows, Linux, macOS

 

Want to see the source code for this command? Check out Install-DbaWhoIsActive on GitHub.
Want to see the Bill Of Health for this command? Check out Install-DbaWhoIsActive.

Synopsis

Automatically installs or updates sp_WhoisActive by Adam Machanic.

Description

This command downloads, extracts and installs sp_WhoisActive with Adam's permission. To read more about sp_WhoisActive, please visit http://whoisactive.com and http://sqlblog.com/blogs/adam_machanic/archive/tags/who+is+active/default.aspx

Please consider donating to Adam if you find this stored procedure helpful: http://tinyurl.com/WhoIsActiveDonate

Note that you will be prompted a bunch of times to confirm an action.

Syntax

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

 

Examples

 

Example: 1
PS C:\> Install-DbaWhoIsActive -SqlInstance sqlserver2014a -Database master

Downloads sp_WhoisActive from the internet and installs to sqlserver2014a's master database. Connects to SQL Server using Windows Authentication.

Example: 2
PS C:\> Install-DbaWhoIsActive -SqlInstance sqlserver2014a -SqlCredential $cred

Pops up a dialog box asking which database on sqlserver2014a you want to install the procedure into. Connects to SQL Server using SQL Authentication.

Example: 3
PS C:\> Install-DbaWhoIsActive -SqlInstance sqlserver2014a -Database master -LocalFile c:\SQLAdmin\sp_WhoIsActive.sql

Installs sp_WhoisActive to sqlserver2014a's master database from the local file sp_WhoIsActive.sql.
You can download this file from https://github.com/amachanic/sp_whoisactive/blob/master/sp_WhoIsActive.sql

Example: 4
PS C:\> Install-DbaWhoIsActive -SqlInstance sqlserver2014a -Database master -LocalFile c:\SQLAdmin\sp_whoisactive-12.00.zip

Installs sp_WhoisActive to sqlserver2014a's master database from the local file sp_whoisactive-12.00.zip.
You can download this file from https://github.com/amachanic/sp_whoisactive/releases

Example: 5
PS C:\> $instances = Get-DbaRegServer sqlserver
PS C:\> Install-DbaWhoIsActive -SqlInstance $instances -Database master

Installs sp_WhoisActive to all servers within CMS

Required Parameters

-SqlInstance

The target SQL Server instance or instances. Server version must be SQL Server version 2005 or higher.

Alias
Required True
Pipeline true (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.

Alias
Required False
Pipeline false
Default Value
-LocalFile

Specifies the path to a local file to install sp_WhoisActive from. This can be either the zip file as distributed by the website or the expanded SQL script. If this parameter is not specified, the latest version will be downloaded and installed from https://github.com/amachanic/sp_whoisactive/releases

Alias
Required False
Pipeline false
Default Value
-Database

The database to install sp_WhoisActive into. This parameter is mandatory when executing this command unattended.

Alias
Required False
Pipeline false
Default Value
-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.

Alias
Required False
Pipeline false
Default Value False
-Force

If this switch is enabled, then sp_WhoisActive will be downloaded from the internet even if previously cached.

Alias
Required False
Pipeline false
Default Value False
-WhatIf

If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.

Alias wi
Required False
Pipeline false
Default Value
-Confirm

If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.

Alias cf
Required False
Pipeline false
Default Value