dbatools is a free PowerShell module with over 180 SQL Server administration, best practice and migration commands included.


Get-DbaProcess

This command displays processes associated with a spid, login, host, program or database.

Screenshots

get-dbaprocess

Examples

To show information about all processes running on sqlserver2014a. Uses Windows Authentication to login to sqlserver2014a.

Get-DbaProcess -SqlServer sqlserver2014a

To show information about the processes for base\ctrlb and sa on sqlserver2014a. Uses Windows Authentication to login to sqlserver2014a.

Get-DbaProcess -SqlServer sqlserver2014a -Logins base\ctrlb, sa

To show information about the processes for spid 56 and 57. Uses alternative (SQL or Windows) credentials to login to sqlserver2014a.

Get-DbaProcess -SqlServer sqlserver2014a -SqlCredential $credential -Spids 56, 77

To show information about the processes that were created in Microsoft SQL Server Management Studio.

Get-DbaProcess -SqlServer sqlserver2014a -Programs ‘Microsoft SQL Server Management Studio’

To show information about the processes that were initiated by hosts (computers/clients) workstationx and server 1000.

Get-DbaProcess -SqlServer sqlserver2014a -Hosts workstationx, server100

Get-Help

From PowerShell, execute Get-Help Get-DbaProcess -Detailed for more information on this function.

Source Code

Want to see the source code? View Get-DbaProcess.ps1 on GitHub
 

Related commands