is this computer on the domain? Return %errorlevel%

B

Babbit

Trying to write somethign that I can put into a batch file to ask if the
computer is on the domain or not. Hopefully it will return either an %
errorlevel% or the name of the domain so I can do a true/false statement.
Thanks
 
O

Oli Restorick [MVP]

Actually, that doesn't tell you the domain that the computer is in. It will
tell you the domain of the currently-logged-in user.

For your environment, that may be the same thing. Also, the fact that a
user from any domain has logged in implies that the computer is in a domain.

Oli
 
M

Mark V

In said:
Trying to write somethign that I can put into a batch file to ask
if the computer is on the domain or not. Hopefully it will return
either an % errorlevel% or the name of the domain so I can do a
true/false statement. Thanks

"is on the domain"
Perhaps you should explain whether you are seeking to know if
a given machine is joined to a domain.
a given user account logged on is logged on locally or to a domain.

%USERDOMAIN% may be useful in the second case.
 
J

Jerold Schulman

Trying to write somethign that I can put into a batch file to ask if the
computer is on the domain or not. Hopefully it will return either an %
errorlevel% or the name of the domain so I can do a true/false statement.
Thanks
if defined userdnsdomain @echo %userName% on %computerName% is logged onto
%userdnsdomain%


Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top