SyntaxFix
Write A Post
Hire A Developer
Questions
It can also be retrieved from the registry:
Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters' | % { $_.'NV HostName', $_.'NV Domain' -join '.' }