commands

^

Get-DbaWaitingTask

Author Shawn Melton (@wsmelton), wsmelton.github.io
Availability Windows, Linux, macOS

 

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

Synopsis

Displays waiting task.

Description

This command is based on waiting task T-SQL script published by Paul Randal.
Reference: https://www.sqlskills.com/blogs/paul/updated-sys-dm_os_waiting_tasks-script-2/

Syntax

Get-DbaWaitingTask
    [-SqlInstance] <DbaInstanceParameter[]>
    [[-SqlCredential] <PSCredential>]
    [[-Spid] <Object[]>]
    [-IncludeSystemSpid]
    [-EnableException]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Get-DbaWaitingTask -SqlInstance sqlserver2014a

Returns the waiting task for all sessions on sqlserver2014a

Example: 2
PS C:\> Get-DbaWaitingTask -SqlInstance sqlserver2014a -IncludeSystemSpid

Returns the waiting task for all sessions (user and system) on sqlserver2014a

Required Parameters

-SqlInstance

The target SQL Server instance or instances. Server version must be SQL Server version XXXX 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
-Spid

Find the waiting task of one or more specific process ids

Alias
Required False
Pipeline true (ByPropertyName)
Default Value
-IncludeSystemSpid

If this switch is enabled, the output will include the system sessions.

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