Public/Get-FQDNfromDN.ps1
function global:Get-FQDNfromDN { <# .EXTERNALHELP HelperFunctions.psm1-Help.xml #> [CmdletBinding()] [OutputType([String])] param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [string]$DistinguishedName ) begin { } process { if ([string]::IsNullOrEmpty($DistinguishedName) -eq $true) { return $null } $domainComponents = $DistinguishedName.ToString().ToLower().Substring($DistinguishedName.ToString().ToLower().IndexOf("dc=")).Split(",") for ($i = 0; $i -lt $domainComponents.count; $i++) { $domainComponents[$i] = $domainComponents[$i].Substring($domainComponents[$i].IndexOf("=") + 1) } $fqdn = [string]::Join(".", $domainComponents) } end { return [string]$fqdn } } #End function Get-FQDNfromDN |