< Back
Resolve-DbaNetworkName
Post
NAME Resolve-DbaNetworkName
SYNOPSIS
Returns information about the network connection of the target computer including NetBIOS name, IP Address, domain
name and fully qualified domain name (FQDN).
SYNTAX
Resolve-DbaNetworkName [[-ComputerName] <Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>]
[[-Credential] <Pscredential>] [-Turbo <Switch>] [-EnableException <Switch>] [<CommonParameters>]
DESCRIPTION
Retrieves the IPAddress, ComputerName from one computer.
The object can be used to take action against its name or IPAddress.
First ICMP is used to test the connection, and get the connected IPAddress.
Multiple protocols (e.g. WMI, CIM, etc) are attempted before giving up.
Important: Remember that FQDN doesn't always match "ComputerName dot Domain" as AD intends.
There are network setup (google "disjoint domain") where AD and DNS do not match.
"Full computer name" (as reported by sysdm.cpl) is the only match between the two,
and it matches the "DNSHostName" property of the computer object stored in AD.
This means that the notation of FQDN that matches "ComputerName dot Domain" is incorrect
in those scenarios.
In other words, the "suffix" of the FQDN CAN be different from the AD Domain.
This cmdlet has been providing good results since its inception but for lack of useful
names some doubts may arise.
Let this clear the doubts:
- InputName: whatever has been passed in
- ComputerName: hostname only
- IPAddress: IP Address
- DNSHostName: hostname only, coming strictly from DNS (as reported from the calling computer)
- DNSDomain: domain only, coming strictly from DNS (as reported from the calling computer)
- Domain: domain only, coming strictly from AD (i.e. the domain the ComputerName is joined to)
- DNSHostEntry: Fully name as returned by DNS [System.Net.Dns]::GetHostEntry
- FQDN: "legacy" notation of ComputerName "dot" Domain (coming from AD)
- FullComputerName: Full name as configured from within the Computer (i.e. the only secure match between AD and
DNS)
So, if you need to use something, go with FullComputerName, always, as it is the most correct in every scenario.
PARAMETERS
-ComputerName [<Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>]
The target SQL Server instance or instances.
This can be the name of a computer, a SMO object, an IP address or a SQL Instance.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Credential [<Pscredential>]
Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory -
Integrated are all supported.
For MFA support, please use Connect-DbaInstance.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-EnableException [<Switch>]
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables
advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own
try/catch.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Turbo [<Switch>]
Resolves without accessing the server itself. Faster but may be less accurate because it relies on DNS only,
so it may fail spectacularly for disjoin-domain setups. Also, everyone has its own DNS (i.e. results may vary
changing the computer where the function runs)
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
Tags: Network, Resolve
Author: Klaas Vandenberghe (@PowerDBAKlaas) | Simone Bizzotto (@niphold)
Website: https://dbatools.io
Copyright: (c) 2018 by dbatools, licensed under MIT
License: MIT https://opensource.org/licenses/MIT
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Resolve-DbaNetworkName -ComputerName sql2014
Returns a custom object displaying InputName, ComputerName, IPAddress, DNSHostName, DNSDomain, Domain,
DNSHostEntry, FQDN, DNSHostEntry for sql2014
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Resolve-DbaNetworkName -ComputerName sql2016, sql2014
Returns a custom object displaying InputName, ComputerName, IPAddress, DNSHostName, DNSDomain, Domain,
DNSHostEntry, FQDN, DNSHostEntry for sql2016 and sql2014
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Get-DbaRegServer -SqlInstance sql2014 | Resolve-DbaNetworkName
Returns a custom object displaying InputName, ComputerName, IPAddress, DNSHostName, DNSDomain, Domain,
DNSHostEntry, FQDN, DNSHostEntry for all SQL Servers returned by Get-DbaRegServer
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>Get-DbaRegServer -SqlInstance sql2014, sql2016\\sqlexpress | Resolve-DbaNetworkName
Returns a custom object displaying InputName, ComputerName, IPAddress, DNSHostName, DNSDomain, Domain,
DNSHostEntry, FQDN, DNSHostEntry for all SQL Servers returned by Get-DbaRegServer
RELATED LINKS
https://dbatools.io/Resolve-DbaNetworkName
SYNOPSIS
Returns information about the network connection of the target computer including NetBIOS name, IP Address, domain
name and fully qualified domain name (FQDN).
SYNTAX
Resolve-DbaNetworkName [[-ComputerName] <Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>]
[[-Credential] <Pscredential>] [-Turbo <Switch>] [-EnableException <Switch>] [<CommonParameters>]
DESCRIPTION
Retrieves the IPAddress, ComputerName from one computer.
The object can be used to take action against its name or IPAddress.
First ICMP is used to test the connection, and get the connected IPAddress.
Multiple protocols (e.g. WMI, CIM, etc) are attempted before giving up.
Important: Remember that FQDN doesn't always match "ComputerName dot Domain" as AD intends.
There are network setup (google "disjoint domain") where AD and DNS do not match.
"Full computer name" (as reported by sysdm.cpl) is the only match between the two,
and it matches the "DNSHostName" property of the computer object stored in AD.
This means that the notation of FQDN that matches "ComputerName dot Domain" is incorrect
in those scenarios.
In other words, the "suffix" of the FQDN CAN be different from the AD Domain.
This cmdlet has been providing good results since its inception but for lack of useful
names some doubts may arise.
Let this clear the doubts:
- InputName: whatever has been passed in
- ComputerName: hostname only
- IPAddress: IP Address
- DNSHostName: hostname only, coming strictly from DNS (as reported from the calling computer)
- DNSDomain: domain only, coming strictly from DNS (as reported from the calling computer)
- Domain: domain only, coming strictly from AD (i.e. the domain the ComputerName is joined to)
- DNSHostEntry: Fully name as returned by DNS [System.Net.Dns]::GetHostEntry
- FQDN: "legacy" notation of ComputerName "dot" Domain (coming from AD)
- FullComputerName: Full name as configured from within the Computer (i.e. the only secure match between AD and
DNS)
So, if you need to use something, go with FullComputerName, always, as it is the most correct in every scenario.
PARAMETERS
-ComputerName [<Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>]
The target SQL Server instance or instances.
This can be the name of a computer, a SMO object, an IP address or a SQL Instance.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Credential [<Pscredential>]
Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory -
Integrated are all supported.
For MFA support, please use Connect-DbaInstance.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-EnableException [<Switch>]
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables
advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own
try/catch.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Turbo [<Switch>]
Resolves without accessing the server itself. Faster but may be less accurate because it relies on DNS only,
so it may fail spectacularly for disjoin-domain setups. Also, everyone has its own DNS (i.e. results may vary
changing the computer where the function runs)
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
Tags: Network, Resolve
Author: Klaas Vandenberghe (@PowerDBAKlaas) | Simone Bizzotto (@niphold)
Website: https://dbatools.io
Copyright: (c) 2018 by dbatools, licensed under MIT
License: MIT https://opensource.org/licenses/MIT
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Resolve-DbaNetworkName -ComputerName sql2014
Returns a custom object displaying InputName, ComputerName, IPAddress, DNSHostName, DNSDomain, Domain,
DNSHostEntry, FQDN, DNSHostEntry for sql2014
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Resolve-DbaNetworkName -ComputerName sql2016, sql2014
Returns a custom object displaying InputName, ComputerName, IPAddress, DNSHostName, DNSDomain, Domain,
DNSHostEntry, FQDN, DNSHostEntry for sql2016 and sql2014
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Get-DbaRegServer -SqlInstance sql2014 | Resolve-DbaNetworkName
Returns a custom object displaying InputName, ComputerName, IPAddress, DNSHostName, DNSDomain, Domain,
DNSHostEntry, FQDN, DNSHostEntry for all SQL Servers returned by Get-DbaRegServer
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>Get-DbaRegServer -SqlInstance sql2014, sql2016\\sqlexpress | Resolve-DbaNetworkName
Returns a custom object displaying InputName, ComputerName, IPAddress, DNSHostName, DNSDomain, Domain,
DNSHostEntry, FQDN, DNSHostEntry for all SQL Servers returned by Get-DbaRegServer
RELATED LINKS
https://dbatools.io/Resolve-DbaNetworkName