I want to retrieve the FQDN name of windows server via powershell script. I have found 2 solution so far:
$server = Invoke-Command -ScriptBlock {hostname}
"$env:computername.$env:userdnsdomain"
will work if separated out like this
"$env:computername"+"$env:userdnsdomain"