07-21-2023, 02:57 PM
to get the fqdn corresponding to the first IpAddress, it took this command:
```
PS C:\Windows\system32> [System.Net.Dns]::GetHostByAddress([System.Net.Dns]::GetHostByName($env:computerName).AddressList[0]).HostName
WIN-1234567890.fritz.box
```
where `[System.Net.Dns]::GetHostByName($env:computerName).AddressList[0]` represents the first IpAddress-Object and `[System.Net.Dns]::GetHostByAddress` gets the dns-object out of it.
If I took the winning solution on my standalone Windows, I got only:
```
PS C:\Windows\system32> (Get-WmiObject win32_computersystem).DNSHostName+"."+(Get-WmiObject win32_computersystem).Domain
WIN-1234567890.WORKGROUP
```
that's not what I wanted.
```
PS C:\Windows\system32> [System.Net.Dns]::GetHostByAddress([System.Net.Dns]::GetHostByName($env:computerName).AddressList[0]).HostName
WIN-1234567890.fritz.box
```
where `[System.Net.Dns]::GetHostByName($env:computerName).AddressList[0]` represents the first IpAddress-Object and `[System.Net.Dns]::GetHostByAddress` gets the dns-object out of it.
If I took the winning solution on my standalone Windows, I got only:
```
PS C:\Windows\system32> (Get-WmiObject win32_computersystem).DNSHostName+"."+(Get-WmiObject win32_computersystem).Domain
WIN-1234567890.WORKGROUP
```
that's not what I wanted.