Domain Name
How do we get the current domain name?
Windows
PowerView
Native PowerShell
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()
Copy link