You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem is in this part of regex (ServerName;(\w+);. The \w character class will match any word character [a-zA-Z_0-9] and doesn't contain the minus character - (see about_regular_expressions), but according to windows naming convention dns host names can contain the minus character -. So this regex can't parse such dns host names correctly.
I suggest replacing (ServerName;(\w+); with (ServerName;([a-zA-Z0-9_-]+);
Steps to Reproduce
As an example, I suggest parsing test SQL Browser response string rather than trying to use Find-DbaInstance command:
Please confirm that you are running the most recent version of dbatools
2.0.4 version is used
> Get-Module dbatools | Select -ExpandProperty Version
Major Minor Build Revision
----- ----- ----- --------
2 0 4 -1
Other details or mentions
No response
What PowerShell host was used when producing this error
PowerShell Core (pwsh.exe), Windows PowerShell (powershell.exe)
PowerShell Host Version
Name Value
---- -----
PSVersion 7.3.6
PSEdition Core
GitCommitId 7.3.6
OS Microsoft Windows 10.0.14393
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
SQL Server Edition and Build number
Microsoft SQL Server 2019 (RTM) - 15.0.2000.5 (X64) Sep 24 2019 13:48:23 Copyright (C) 2019 Microsoft Corporation Developer Edition (64-bit) on Windows Server 2022 Standard 10.0 (Build 20348: ) (Hypervisor)
.NET Framework Version
.NET 7.0.9
The text was updated successfully, but these errors were encountered:
Verified issue does not already exist?
I have searched and found no existing issue
What error did you receive?
If sql server name contains the minus character
-
, e.g.foo-bar-01
, the command:returns nothing, because of regex in function Get-SQLInstanceBrowserUDP.
The problem is in this part of regex
(ServerName;(\w+);
. The\w
character class will match any word character[a-zA-Z_0-9]
and doesn't contain the minus character-
(see about_regular_expressions), but according to windows naming convention dns host names can contain the minus character-
. So this regex can't parse such dns host names correctly.I suggest replacing
(ServerName;(\w+);
with(ServerName;([a-zA-Z0-9_-]+);
Steps to Reproduce
As an example, I suggest parsing test SQL Browser response string rather than trying to use Find-DbaInstance command:
Please confirm that you are running the most recent version of dbatools
2.0.4 version is used
Other details or mentions
No response
What PowerShell host was used when producing this error
PowerShell Core (pwsh.exe), Windows PowerShell (powershell.exe)
PowerShell Host Version
SQL Server Edition and Build number
Microsoft SQL Server 2019 (RTM) - 15.0.2000.5 (X64) Sep 24 2019 13:48:23 Copyright (C) 2019 Microsoft Corporation Developer Edition (64-bit) on Windows Server 2022 Standard 10.0 (Build 20348: ) (Hypervisor)
.NET Framework Version
.NET 7.0.9
The text was updated successfully, but these errors were encountered: