How do we get the current domain name?
C:\> echo %USERDNSDOMAIN%
C:\> systeminfo | findstr /B /C:"Domain"
C:\> wmic computersystem get domain
PS C:\> Get-Domain
PS C:\> [System.Net.Dns]::GetHostByName(($env:computerName)) PS C:\> [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
Last updated 4 years ago
Was this helpful?