From e43a714e6e0bf532dace62b32f35c1e57197a9e8 Mon Sep 17 00:00:00 2001 From: uncletimmy3 <34276679+uncletimmy3@users.noreply.github.com> Date: Mon, 4 Sep 2023 18:03:24 +0500 Subject: [PATCH 1/2] Update Find-DbaInstance.ps1 fix issues 9071 --- public/Find-DbaInstance.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/Find-DbaInstance.ps1 b/public/Find-DbaInstance.ps1 index bf1d4a6dec..8274cd729e 100644 --- a/public/Find-DbaInstance.ps1 +++ b/public/Find-DbaInstance.ps1 @@ -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 @@ -1083,4 +1083,4 @@ function Find-DbaInstance { } $steppablePipeline.End() } -} \ No newline at end of file +} From bd8c7fa8bac9d9682975835c5e45d86037983499 Mon Sep 17 00:00:00 2001 From: uncletimmy3 <34276679+uncletimmy3@users.noreply.github.com> Date: Tue, 5 Sep 2023 13:08:38 +0500 Subject: [PATCH 2/2] Update Find-DbaInstance.Tests.ps1 try to fix test --- tests/Find-DbaInstance.Tests.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Find-DbaInstance.Tests.ps1 b/tests/Find-DbaInstance.Tests.ps1 index a877984620..2903da74a3 100644 --- a/tests/Find-DbaInstance.Tests.ps1 +++ b/tests/Find-DbaInstance.Tests.ps1 @@ -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]" { @@ -42,4 +42,4 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" { $results.SqlConnected | Should -Be $true } } -} \ No newline at end of file +}