One quick way to determine the name of the domain you are connected to is WMI:
PS> Get-CimInstance -ClassName Win32_NTDomain DomainName DnsForestName DomainControllerName ---------- ------------- --------------------
If you are not connected to a domain, the result is an empty object.