< Back

Install-DbaWhoIsActive

Mon Jan 13, 2020 12:07 pm

NAME Install-DbaWhoIsActive



SYNOPSIS

Automatically installs or updates sp_WhoisActive by Adam Machanic.





SYNTAX

Install-DbaWhoIsActive [-SqlInstance] <Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]> [-SqlCredential

<Pscredential>] [-LocalFile <String>] [-Database <System.Object>] [-EnableException <Switch>] [-Force <Switch>]

[<CommonParameters>]





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/ ... fault.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.





PARAMETERS

-Database [<System.Object>]

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

unattended.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-EnableException [<Switch>]

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.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-Force [<Switch>]

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



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-LocalFile [<String>]

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://whoisactive.com/



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-SqlCredential [<Pscredential>]

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.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-SqlInstance [<Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>]

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



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



NOTES





Tags: Community, WhoIsActive

Author: Chrissy LeMaire (@cl), netnerds.net



Website: https://dbatools.io

Copyright: (c) 2018 by dbatools, licensed under MIT

License: MIT https://opensource.org/licenses/MIT



http://whoisactive.com



-------------------------- 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\\whoisactive_install.sql



Installs sp_WhoisActive to sqlserver2014a's master database from the local file whoisactive_install.sql

-------------------------- EXAMPLE 4 --------------------------



PS C:\\>$instances = Get-DbaRegServer sqlserver



PS C:\\> Install-DbaWhoIsActive -SqlInstance $instances -Database master



Installs sp_WhoisActive to all servers within CMS



RELATED LINKS

https://dbatools.io/Install-DbaWhoIsActive