ps/Modules/Alkami.PowerShell.Common/Public/Get-FullyQualifiedServerName.ps1

22 lines
615 B
PowerShell
Raw Normal View History

2023-05-30 22:51:22 -07:00
function Get-FullyQualifiedServerName {
<#
.SYNOPSIS
Returns the fully qualified server name
#>
param (
)
$globalIPProperties = [System.Net.NetworkInformation.IPGlobalProperties]::GetIPGlobalProperties();
# If no domain is present, return just the hostname. If there is a domain, . append it after the hostname
if ($globalIPProperties.DomainName.length -gt 0) {
$qualifiedServerName = "{0}.{1}" -f $globalIPProperties.HostName, $globalIPProperties.DomainName;
}
else {
$qualifiedServerName = $globalIPProperties.HostName;
}
return $qualifiedServerName
}