Kamis, 30 November 2017

find domain name


Windows Command Line
A-Z Windows Commands, Batch files, Dos and PowerShell
Find domain name from command line
by Srini

We can find the domain name of a computer by running the following commnad from command line.

systeminfo | findstr /B /C:"Domain"

We can find the logged in user’s domain by using the environment variable ‘USERDOMAIN’. Command for this is given below.

echo %userdomain%

Note that the value in %USERDOMAIN% may not be the same as the one returned by systeminfo command. %USERDOMAIN% gives the domain name the user account belongs to, it could be different from the domain of the computer. Also, this may give you the NetBios name of the computer, not DNS/FQDN name. 









Alternatively, we can use WMIC to retrieve domain name.

wmic computersystem get domain

15 comments… add one

    BINISH

    Whatt is the command to view domain name in windows 7
    Reply Link
        Srini

        All the above commands work on Windows 7. WMIC one may/may not work depending on whether the edition of win7 you have supports it or not.
        Link
    admin

    The systeminfo command given in this post works on Windows 7 also. I think copying the command from this page had some problem and it did not work. Have corrected it. It should work now.
    Reply Link
    me

    systeminfo | findstr Domain

    I see no reason for the /b /c:” “
    Reply Link
        admin

        /C may not be required. /b is required to avoid matches with the values for other fields of systeminfo command.
        Link
    ak

    Thanks! Useful!! Keep it up your good work!!!
    Reply Link
    GDS

    Thanks for this! I needed to pull the domain for a powershell script for use on servers that didn’t have the ActiveDirectory module (and I wasn’t going to install it).

    This enabled me to grab the domain, then trim out the header and return in Powershell for my variable.

    Thanks again!

    GDS
    Reply Link
    KCBI

    This command returns domain or workgroup: net config workstation
    * If domain: “Workstation Domain DNS Name”
    * If group: “Workstation domain”
    Reply Link
    Benja_Ninja

    Get-WmiObject is not recognized as a command. Any help guys?
    Reply Link
    John C.

    Can someone please guide me on how to obtain the domain name of the servers remotely. I need to get the domain name for hunderds of servers.
    Is there a way to create a CSV file with the server names and create a batch file and run it to obtain this information?
    Any help would be highly appreciated.
    Thanks.
    Reply Link
        ANON

        wmic /node:”COMPUTERNAME” computersystem get domain
        Link
    Deepak

    I am getting domain as workgroup. what’s wrong here?

    C:\>systeminfo | findstr /B /C:"Domain"
    Domain:                    WORKGROUP

    Reply Link
        Srini

        It means that your computer is not part of a domain but a workgroup. All the home computers are part of a workgroup.
        Link
    amy

    what is domain for windows 8? i need it for change to administrator, it is will work?
    Reply Link
    Sokchea Heang

    thanks for share me the value knowledge
    Reply Link

Share on Facebook
Share on Twitter
Share on Google+
Tags :

Related : find domain name

0 komentar:

Posting Komentar