How do you destinguish a Domain from a Workgroup?

  • Thread starter Thread starter tbader01
  • Start date Start date
T

tbader01

Hello Everyone!

I use the following NT shell code to determine a remote
machines domain/workgroup name:

REM Add '<' as a delimiter.A long domain name can come up
to the <00> entry.
SET PARAMS="tokens=1 delims=< "
FOR /F %PARAMS% %%a IN ('NBTSTAT -a %SERVERNAME%
^|FIND /I "<00> GROUP"') DO SET DOM="%%a"

I would like to further determine a workgroup from a
domain, but am not quite sure how to accomplish this.
If at all possible, using commands such as NBTSTAT that
are native to any box would be preferred, but anything
will help!

Thanks!
 
Hello Everyone!

I use the following NT shell code to determine a remote
machines domain/workgroup name:

REM Add '<' as a delimiter.A long domain name can come up
to the <00> entry.
SET PARAMS="tokens=1 delims=< "
FOR /F %PARAMS% %%a IN ('NBTSTAT -a %SERVERNAME%
^|FIND /I "<00> GROUP"') DO SET DOM="%%a"

I would like to further determine a workgroup from a
domain, but am not quite sure how to accomplish this.
If at all possible, using commands such as NBTSTAT that
are native to any box would be preferred, but anything
will help!

Thanks!

if "%userdomain%" EQU "%computername%" goto workgroup
@echo %userdnsdomain%




Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
Jerold Schulman said:
if "%userdomain%" EQU "%computername%" goto workgroup
@echo %userdnsdomain%

This will only tell whether the currently logged-on user is a member of the
domain or a local login. You can still log into local accounts when your
computer is part of a domain. It does not determine if the group listed in
nbtstat -a is a workgroup or domain.

I don't happen to know a way to do this.

David
Stardate 3698.3
 
David said:
This will only tell whether the currently logged-on user is a member of the
domain or a local login. You can still log into local accounts when your
computer is part of a domain. It does not determine if the group listed in
nbtstat -a is a workgroup or domain.

I don't happen to know a way to do this.

Hi

Parsing the output from Netdom v. 1.8 is an option:

http://groups.google.com/[email protected]
http://groups.google.com/[email protected]


Without using any "external" utilities, WMI/VBScript is another option:

http://groups.google.com/[email protected]
 
Hello Everyone!

I use the following NT shell code to determine a remote
machines domain/workgroup name:

REM Add '<' as a delimiter.A long domain name can come up
to the <00> entry.
SET PARAMS="tokens=1 delims=< "
FOR /F %PARAMS% %%a IN ('NBTSTAT -a %SERVERNAME%
^|FIND /I "<00> GROUP"') DO SET DOM="%%a"

I would like to further determine a workgroup from a
domain, but am not quite sure how to accomplish this.
If at all possible, using commands such as NBTSTAT that
are native to any box would be preferred, but anything
will help!

Thanks!

Here's an ugly way to do it with NbtStat. I was not able to test it
right now, sorry.

Set Member=Workgroup
for /f "delims=\ " %%a in ('net view /domain:%DOM% ^| find "\\"') do (
nbtstat -a %%a | find "<1C> GROUP"
if %ERRORLEVEL% EQU 0 set Member=Domain)

A domain controller will have the NetBIOS group suffix of "<1C>"
whereas in a workgroup that value shouldn't occur.

Clay Calvert
(e-mail address removed)
Replace "W" with "L"
 
Back
Top