JSI Tip 9555. How can a script return the domains and workgroups on my network?

Jerold Schulman

July 13, 2005

1 Min Read
ITPro Today logo in a gray background | ITPro Today

Using the NET VIEW command, I have scripted nwk.bat to return the NetBIOS domain and workgroup names that exist on your network.

The Syntax for using nwk.bat is:

[call] nwkorfor /f "Tokens=*" %%w in ('nwk') do ( @echo %%w)

nwk.bat contains:

@echo offfor /f "Skip=3 Tokens=*" %%d in ('net view /DOMAIN') do ( for /f "Tokens=1" %%x in ('@echo %%d^|FIND /V "The command"') do (  @echo %%x ))



Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like