Skip to content

Commit

Permalink
Merge branch 'development' into InstallDbaDarlingData_update
Browse files Browse the repository at this point in the history
  • Loading branch information
potatoqualitee committed Apr 11, 2024
2 parents 04d980a + c671a9e commit 35c76da
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
14 changes: 6 additions & 8 deletions public/Connect-DbaInstance.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -948,14 +948,12 @@ function Connect-DbaInstance {
# But ConnectionContext.IsOpen does not tell the truth if the instance was just shut down
# And we don't use $server.ConnectionContext.Connect() as this would create a non pooled connection
# Instead we run a real T-SQL command and just SELECT something to be sure we have a valid connection and let the SMO handle the connection
if (-not $DedicatedAdminConnection) {
try {
Write-Message -Level Debug -Message "We connect to the instance by running SELECT 'dbatools is opening a new connection'"
$null = $server.ConnectionContext.ExecuteWithResults("SELECT 'dbatools is opening a new connection'")
Write-Message -Level Debug -Message "We have a connected server object"
} catch {
Stop-Function -Target $instance -Message "Failure" -Category ConnectionError -ErrorRecord $_ -Continue
}
try {
Write-Message -Level Debug -Message "We connect to the instance by running SELECT 'dbatools is opening a new connection'"
$null = $server.ConnectionContext.ExecuteWithResults("SELECT 'dbatools is opening a new connection'")
Write-Message -Level Debug -Message "We have a connected server object"
} catch {
Stop-Function -Target $instance -Message "Failure" -Category ConnectionError -ErrorRecord $_ -Continue
}

if ($AzureUnsupported -and $server.DatabaseEngineType -eq "SqlAzureDatabase") {
Expand Down
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
3 changes: 2 additions & 1 deletion public/Install-DbaInstance.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,8 @@ function Install-DbaInstance {
foreach ($fd in $featureDef) {
if (($fd.MinimumVersion -and $canonicVersion -lt [version]$fd.MinimumVersion) -or ($fd.MaximumVersion -and $canonicVersion -gt [version]$fd.MaximumVersion)) {
# exclude Default, All, and Tools, as they are expected to have SSMS components in some cases
if ($f -notin 'Default', 'All', 'Tools') {
# exclude MachineLearning, as not all components are needed based on version
if ($f -notin 'Default', 'All', 'Tools', 'MachineLearning') {
Stop-Function -Message "Feature $f($($fd.Feature)) is not supported on SQL$Version"
return
}
Expand Down

0 comments on commit 35c76da

Please sign in to comment.