Skip to content

Commit

Permalink
Get-DbaProcess - Add information about endpoint and DAC (#9304)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasjordan authored Apr 11, 2024
1 parent 86b3f3d commit ec07484
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions public/Get-DbaProcess.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,14 @@ function Get-DbaProcess {
c.encrypt_option AS EncryptOption,
c.auth_scheme AS AuthScheme,
c.net_packet_size AS NetPacketSize,
c.client_net_address AS ClientNetAddress
c.client_net_address AS ClientNetAddress,
e.name AS EndpointName,
e.is_admin_endpoint AS IsDac
FROM sys.dm_exec_connections c
JOIN sys.dm_exec_sessions s
on c.session_id = s.session_id
JOIN sys.endpoints e
ON c.endpoint_id = e.endpoint_id
CROSS APPLY sys.dm_exec_sql_text(c.most_recent_sql_handle) t"

if ($server.VersionMajor -gt 8) {
Expand Down Expand Up @@ -195,8 +199,10 @@ function Get-DbaProcess {
Add-Member -Force -InputObject $session -MemberType NoteProperty -Name NetPacketSize -value $row.NetPacketSize
Add-Member -Force -InputObject $session -MemberType NoteProperty -Name ClientNetAddress -value $row.ClientNetAddress
Add-Member -Force -InputObject $session -MemberType NoteProperty -Name LastQuery -value $row.Query
Add-Member -Force -InputObject $session -MemberType NoteProperty -Name EndpointName -value $row.EndpointName
Add-Member -Force -InputObject $session -MemberType NoteProperty -Name IsDac -value $row.IsDac

Select-DefaultView -InputObject $session -Property ComputerName, InstanceName, SqlInstance, Spid, Login, LoginTime, Host, Database, BlockingSpid, Program, Status, Command, Cpu, MemUsage, LastRequestStartTime, LastRequestEndTime, MinutesAsleep, ClientNetAddress, NetTransport, EncryptOption, AuthScheme, NetPacketSize, ClientVersion, HostProcessId, IsSystem, LastQuery
Select-DefaultView -InputObject $session -Property ComputerName, InstanceName, SqlInstance, Spid, Login, LoginTime, Host, Database, BlockingSpid, Program, Status, Command, Cpu, MemUsage, LastRequestStartTime, LastRequestEndTime, MinutesAsleep, ClientNetAddress, NetTransport, EncryptOption, AuthScheme, NetPacketSize, ClientVersion, HostProcessId, IsSystem, EndpointName, IsDac, LastQuery
}
}
}
Expand Down

0 comments on commit ec07484

Please sign in to comment.