Add FQDN to Connect-DbaInstance output #7008
Replies: 6 comments 5 replies
-
Whenever a function needs to operate on the underlying server starting from
the SQL instance, it should use resolve-dbanetworkname and use its
fullcomputername property . This Is usually the way other functions do
their work.
Il mer 2 dic 2020, 13:24 John Q. Martin <[email protected]> ha
scritto:
… While using Set-DbaStartupParameter recently to set some traceflags I hit
an issue where the cmdlet was failing. I tracked this back to the way that
the Computer Name is passed into the Resolve-DbaNetworkName as part of the
Invoke-ManagedComputerCommand function call.
The root cause is that in a complex environment where there are multiple
forests etc, if there are any issues with DNS forwarders that prevent the
resolution of the name then the cmdlet will fail. However, if it were to
use the FQDN which was supplied into Set-DbaStartupParameter cmdlet then it
would work.
I would make a suggestion that adding the FQDN as a property for the
output from Connect-DbaInstance would then allow the use of that as opposed
to the hostname to be passed into other commands around the DbaTools
ecosystem.
I have a workaround which is to manually add the DNS suffixes to the local
NIC properties (ultimately getting DNS to work properly is the plan) but it
would be good to try and avoid a reliance on environmental configurations
wherever possible.
What are people's thoughts on this?
JQ
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#7008>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAA52B6FRCHINNB7HUNHKWDSSYWXVANCNFSM4UKNM7DA>
.
|
Beta Was this translation helpful? Give feedback.
-
Yeah, okay. Lemme rephrase...We do have multiple functions that need to do
this kind of translation between instance and server and
resolve-dbanetworkname is the way to go.
The resolution imho is going in and fix the place where the suffix get lost
and preserve it in the "chain"...I believe resolve-dbanetworkname is not
the problem here, but rather the function that calls it.
Il mer 2 dic 2020, 13:45 John Q. Martin <[email protected]> ha
scritto:
… I understand that, but when the DNS system in an environment does not work
then the Resolve-DbaNetworkName function cannot resolve the server to get
any data back.
When you look at the process here the original command is being passed a
FQDN which through the various processes has the domain name removed and
then tries to re-resolve the server details again. If there is an
environmental issue then that will break the process and means that the
command will fail.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#7008 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAA52B5UKCYIE6EJGTOKUWDSSYZH3ANCNFSM4UKNM7DA>
.
|
Beta Was this translation helpful? Give feedback.
-
I mean, that being said and assuming instead the function is doing its best to avoid truncating the suffix, you can't really expect dbatools to work swiftly in an environment where DNS resolution is not working ... it's unfortunate that the SQL instance does not provide any information on the suffix and we try the best we can with Resolve-DbaNetworkName which is a "taxing" function... but it exists to support several WORKING setups (and I feel you, I work in an environment where AD and DNS are disjoint). |
Beta Was this translation helpful? Give feedback.
-
I believe we have a config setting that skips resolution entirely that can help Try this: If that works, set it permanently instead of just in that session: If that doesn't work, we can explore @niphlod's solution |
Beta Was this translation helpful? Give feedback.
-
Sure, but still the full passed "string" should be piped down to
resolve-dbanetworkname. Skipping the resolution via that configuration just
makes all properties of the call returning the input object untouched.
Here I believe get-dbastartupparameter is dropping the suffix in all
cases, so skipping resolution logic isn't going to solve anything regarding
the fact that you pass an fqdn to set-dbastartupparameter and It passes to
resolve-dbanetworkname the computername property of the instance object,
which doesn't have the suffix part.
Il mer 2 dic 2020, 21:25 Chrissy LeMaire <[email protected]> ha
scritto:
… I believe we have a config setting that skips resolution entirely that can
help
Try this:
Set-DbatoolsConfig -FullName commands.resolve-dbanetworkname.bypass -Value
$true
If that works, set it permanently instead of just in that session:
Set-DbatoolsConfig -FullName commands.resolve-dbanetworkname.bypass -Value
$true -Register
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#7008 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAA52B74NOGMDVDNORIXZMLSS2PFLANCNFSM4UKNM7DA>
.
|
Beta Was this translation helpful? Give feedback.
-
Hi @johnmart82 , can you do me a favor? Try using the new codepath in Connect-DbaInstance and see if this helps you a bit. The big difference is, that when you pass a computername with domain as -SqlInstance, the .ComputerName property is set with the domain.
|
Beta Was this translation helpful? Give feedback.
-
While using Set-DbaStartupParameter recently to set some traceflags I hit an issue where the cmdlet was failing. I tracked this back to the way that the Computer Name is passed into the Resolve-DbaNetworkName as part of the Invoke-ManagedComputerCommand function call.
The root cause is that in a complex environment where there are multiple forests etc, if there are any issues with DNS forwarders that prevent the resolution of the name then the cmdlet will fail. However, if it were to use the FQDN which was supplied into Set-DbaStartupParameter cmdlet then it would work.
I would make a suggestion that adding the FQDN as a property for the output from Connect-DbaInstance would then allow the use of that as opposed to the hostname to be passed into other commands around the DbaTools ecosystem.
I have a workaround which is to manually add the DNS suffixes to the local NIC properties (ultimately getting DNS to work properly is the plan) but it would be good to try and avoid a reliance on environmental configurations wherever possible.
What are people's thoughts on this?
JQ
Beta Was this translation helpful? Give feedback.
All reactions