Skip to content

Commit

Permalink
Find-DbaInstance - Fix regex for UDP Search (#9072)
Browse files Browse the repository at this point in the history
  • Loading branch information
uncletimmy3 authored Sep 21, 2023
1 parent 7f5e149 commit c984b2e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions public/Find-DbaInstance.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ function Find-DbaInstance {
#endregion Connect to browser service and receive response

#region Parse Output
$Response | Select-String "(ServerName;(\w+);InstanceName;(\w+);IsClustered;(\w+);Version;(\d+\.\d+\.\d+\.\d+);(tcp;(\d+)){0,1})" -AllMatches | Select-Object -ExpandProperty Matches | ForEach-Object {
$Response | Select-String "(ServerName;([a-zA-Z0-9_-]+);InstanceName;(\w+);IsClustered;(\w+);Version;(\d+\.\d+\.\d+\.\d+);(tcp;(\d+)){0,1})" -AllMatches | Select-Object -ExpandProperty Matches | ForEach-Object {
$obj = New-Object Dataplat.Dbatools.Discovery.DbaBrowserReply -Property @{
MachineName = $computer.ComputerName
ComputerName = $_.Groups[2].Value
Expand Down Expand Up @@ -1083,4 +1083,4 @@ function Find-DbaInstance {
}
$steppablePipeline.End()
}
}
}
6 changes: 3 additions & 3 deletions tests/Find-DbaInstance.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" {
Context "Command finds SQL Server instances" {
BeforeAll {
if ($env:APPVEYOR) {
$results = Find-DbaInstance -ComputerName $script:instance3 -ScanType Browser, SqlConnect
$results = Find-DbaInstance -ComputerName $script:instance3 -ScanType Browser, SqlConnect | Select-Object -First 1
} else {
$results = Find-DbaInstance -ComputerName $TestServer -ScanType Browser, SqlConnect
$results = Find-DbaInstance -ComputerName $TestServer -ScanType Browser, SqlConnect | Select-Object -First 1
}
}
It "Returns an object type of [Dataplat.Dbatools.Discovery.DbaInstanceReport]" {
Expand All @@ -42,4 +42,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" {
$results.SqlConnected | Should -Be $true
}
}
}
}

0 comments on commit c984b2e

Please sign in to comment.