I have a requirement to find DNS registered hostname of a given IP via PowerShell. Could someone please tell me how can I store computer name alone (“mysystem” in below example) to a variable from below output.
$Hostname = [System.Net.Dns]::GetHostEntry($ipAddress)
HostName Aliases AddressList
-------- ------- -----------
mysystem.mycountry.company.com {} {fe80::50d6:7029:f655:f955%11,