Home > Networking > How to Determine the Master Browser in a Windows Workgroup

How to Determine the Master Browser in a Windows Workgroup

February 14th, 2009

NetworkHere’s a little problem that drove me crazy: How do you determine the Master Browser in a Windows Workgroup?

First of all, lemme explain a bit about how a workgroup works. When you have a LAN set up running Windows machines, each machine can see all the others in Network Neighborhood (or just “Network” in Vista). If you want to see the files on another machine, you just go to Network Neighborhood, click, et voila!

The other method you can use is to open Windows Explorer (keyboard shortcut: Win-E) and in the location/address bar, type:

\\COMPUTER-NAME

So, if you want to go to the computer called BALTHAZAR, you’d type:

\\BALTHAZAR

And hit enter. This is handy to know if Network Neighborhood is not working. And a grumpy Network Neighborhood is exactly the reason why sometimes, you need to find out which computer is the Master Browser.

On a local area network (LAN), each computer “talks” to the others. Each computer has an IP address, like 192.168.0.27, and also a name. The name is what you call your computer so you and your friends don’t have to remember the IP address. In our example above, the computer name is BALTHAZAR, but the IP address might be 192.168.0.27. Fabulous.

So, what happens is that each computer on the LAN must talk to the others. Since we’re only dealing with a workgroup, and there is no domain server, there is no computer to keep track of what machines are active on the network. This is where the Master Browser schtick comes into play.

What happens is that all the computers on your LAN hold an “election”. This election depends on a number of factors, but for the purposes of this discussion, we just have to know that all the computers get together and vote on who will be the Master Browser on the LAN. Once a computer is elected, it will keep track of what machines are connected to the LAN by more or less sending messages to say, “Yo! You still there?”

Of course, you may ask: What happens when the computer that is the Master Browser gets shut down when, say, I go to bed? In that case, you will find that your Network Neighborhood may not work so well. At that point, all the computers on the LAN get together again and they hold another election. As I understand it, there are one or more “Backup Master Browsers” waiting in the wings, but we’ll ignore that for now.

Now, what happens when you have Network Neighborhood turning up blank on you sporadically, or possibly missing several of the computers on your LAN from time to time? Well, in that case, you need to determine who is the Master Browser so that you can narrow down the problem to one computer and see if maybe you need an updated ethernet driver, or there are firewall problems, or whatever.

The “fun” way of doing this is with DOS commands. Here’s how you’d do it:

  1. Open up a command prompt
  2. Type net view and hit enter
  3. Look at the list of computer names. These are the computers on your LAN. Note that the format is \\COMPUTER-NAME like I talked about above.
  4. For each name in the list, type the following command: nbtstat -a COMPUTER-NAME

One of the results from the nbtstat commands will show a row with “_MSBROWSE_” in it. That means that this computer is the Master Browser.

Wasn’t that fun?

No, it wasn’t.

So, I wrote a little script in Ruby to do this for you. I needed to in order to troubleshoot a networking problem on one machine on my LAN, and I didn’t want to type 10-20 commands every time. But as long as I was writing it, I figured I would jack it up a bit. Here’s what it does:

  • net view net view /domain to determine the list of workgroup names
  • net view /domain:[WORKGROUP] to determine the list of puter names for each [WORKGROUP]
  • extracts the individual computer names and sticks them in an array
  • iterates through the array and calls ping -n 1 -4 COMPUTER-NAME on each computer name (we only want to display IPv4 addresses, hence the “-4″ switch)
  • iterates through the array of IP addresses and calls nbtstat -A IP-ADDRESS (the “-A” means “I’m giving you an IP address instead of a computer name”. This is a more reliable way of doing things.)
  • After each call to nbtstat, it not only checks for the _MSBROWSE_ string, but it also records the MAC address of the network adapter in the remote computer.
  • iterates through all the data and displays a nicely formatted table, like so:
Scanning LAN...

BERT            192.168.0.102   00-18-C0-42-A3-B2   CHEESE
BIGBUBBALOU     192.168.0.103   00-26-32-1F-72-ED   WORKGROUP
RHINOX          192.168.0.101   00-00-00-00-00-00   WORKGROUP   MASTER
Q               192.168.0.100   00-28-F6-68-F5-48   WORKGROUP
RADDAR          192.168.0.105   00-02-0D-74-FC-33   CHEESE
ANGELINA        192.168.0.106   00-B0-7E-C3-F7-A4   CHEESE
MOP             192.168.0.104   00-1B-8C-56-01-52   CHEESE      MASTER
AI              192.168.0.107   00-6A-83-6B-A0-83   WORKGROUP

Press any key to exit...

I wrote this little script in Ruby because it was fast and easy. But I didn’t want to have to call it from a command prompt with ruby all the time, and I wanted others to be able to use it without having to install Ruby on their own computers. So, I compiled it into a self-contained executable using RubyScript2Exe, and I added a pretty icon with Resource Hacker. Now my nifty little 2kB script is a lovely 1.5MB executable. Well, ya know… You can’t have everything. It may be bloated, but at least it works!

You can run it from the command line, or from Windows. If you run it from Windows, it will just open up a command prompt window and pause before closing it so you can see the results. On my machine, it’s nice and speedy. Oh, and one last note: it might take 30 seconds or so to scan your LAN. The more machines you have, the more work it was to do.

So, now you have a lovely tool to determine the IP address, MAC address, name, and Master Browser status of all the computers on your LAN.

UPDATE (8 June 2009): My little LANscanner program has been updated to version 1.1. It now supports the x64 flavor of Windows XP, Vista, and 7. Be sure to read the included .TXT file for install instructions!

UPDATE (27 February 2010): LANscanner has been updated to version 1.2. New in this release is the display of the workgroup for each computer, as well as formatting improvements that should make the output easier to read even with long computer/workgroup names.

UPDATE (20 March 2010): LANscanner has been updated to version 1.3. This release is mostly a bug fix for 1.2. In the older version, the only workgroup reported was the one your puter was on. Oops! That didn’t make the feature very useful. Now LANscanner will first scan for all available workgroups, and accurately report all machines on all workgroups, including which puter is the Master Browser for each workgroup. I also optimized some code here and there for good measure.

Download

Scottie Networking , , , ,

  1. Jean Villeneuve
    February 14th, 2010 at 16:11 | #1

    Hi Scottie!

    I wish I had found this earlier, by the time I got here I already figured it out but it drove me crazy too. The only thing left to find is why the windows 7 laptop won’t accept that he is not the Local Master Browser when the XP machine in the workgroup is fired first.
    Your script is coming handy in my research.
    By the way I thought you were dead Scotty… must be a time traveling paradox!

    Jean

  2. February 22nd, 2010 at 15:56 | #2

    @Jean Villeneuve
    Hmm, that is strange. As I understand it, the Master Browser election process favors newer versions of Windows. So, even if the XP box is Master first, when the 7 machine fires up, he should eventually take over.

    Unfortunately, these things don’t always work the way they are supposed to. On a Vista, XP, 7, and Linux local network, I had to actually set Samba up on the one Linux box to always be the Master Browser, and suddenly all networking problems went away on all machines.

    Samba usually gives me nothing but grief, but this time it saved me!

  3. Robert
    February 25th, 2010 at 10:46 | #3

    Hi Scottie,

    for some strange reason my first try to submit a comment faild…anyways, great tool!

    I have a question regarding master browser on win7: is there a way to competely force a win7 computer to *not* become the master?

    thanks and kind regards,
    robert

    • February 25th, 2010 at 12:37 | #4

      You can try using regedt32 to set the following on the machine you do NOT want to become the Master Browser:

      HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Browser\Parameters\ISDomainMaster = False
      HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Browser\Parameters\MaintainServerList = Auto

      I haven’t tried this, but I think it should work for Win 7 as well as for XP and Vista. To set a machine to be the MB:

      HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Browser\Parameters\ISDomainMaster = True
      HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Browser\Parameters\MaintainServerList = Yes

      I’m not sure this works exactly the same way in 7, because the ISDomainMaster key is missing for me. When a Vista machine is master on a network with 7, things just don’t work very well, and it seems that Vista likes to fight with 7 for some reason – even though 7 should have priority for MB status. With a machine on a domain, it seems things get hairy and I’ve never had to deal with that particular situation.

  4. Robert
    February 25th, 2010 at 14:54 | #5

    Thanks for the hint…I’ve read about theses settings before, but since they are missing and most of the posts were talking about XP or even NT4 I thought it would be outdated.

    Does the computer browser service play any role in this? Couldn’t it be as easy as just disabling this service?

    Regards, Robert

    • February 25th, 2010 at 16:01 | #6

      As far as I know, the browser service is required for network browsing even if the machine is not the master browser.

  5. Robert
    February 25th, 2010 at 15:39 | #7

    Another thing I just found out: my domain notebook doesn’t even have the Parameters-key…while my win7 “homeserver” does but lacks the ISDomainMaster value…do you suggest also creating the other values (ServiceDLL and ServiceDllUnloadOnStop) on the notebook alongside with the ISDomainMaster and MaintainServerList values?

    Thanks,
    Robert

    • February 25th, 2010 at 16:05 | #8

      Hmm, that I don’t know. I’m not even sure if the ISDomainMaster value works in 7. There is a pretty severe lack of information on the net about Win 7 networking, at least as far as the MB is concerned. I would just have to play around with it and see if I could get it to work.

  6. lsi
    March 9th, 2010 at 15:13 | #9

    The Master Browser can be displayed using the BROWSTAT utility (not tested by me), it’s in the XP Resource Kit apparently – http://support.microsoft.com/kb/188305/en-us

    The Master Browser can also be displayed with the Windows 2000 resource kit, using the BROWMON utility (tested OK).

    Also, according to M$ the browser service should NOT be run on all machines – http://support.microsoft.com/kb/135404/en-us

    Finally, if you’re trying to figure out why your Samba server lost a browser election – os level 255 in smb.conf is your friend.

  7. March 20th, 2010 at 18:58 | #10

    I discovered a new toy today:

    net view /domain

    This will display the workgroups on your LAN. Then you can do:

    net view /domain:MSHOME

    for example to view all the machines on the MSHOME workgroup.

    This has now been incorporated in LANscanner v1.3, which you can download above. IOW, you get accurate workgroup reporting along with which machine is the Master on which workgroup.

  8. RENATO
    March 22nd, 2010 at 10:11 | #11

    I have 3 pc on my lan. For test purposes I put 2 pc on MSHOME workgroup and one in MS workgroup. If I run net view /domain on one pc on MSHOME it lists both workgroups. If I do the same on MS pc lists MS only.
    After a while (may be half hour) the MS pc lists again both (as the day before). Probably because the networking updates very slowly the state of its componente. This makes unuseful all the try to get all the pc on lan.
    More over your tool fails with error 87 after net view command.

    I tried your tool…gives me an error…

    • March 22nd, 2010 at 12:18 | #12

      @RENATO

      The MS/MSHOME problem does indeed sound like slow Windows networking. If the computers stay on all the time, everything works well. If one or more machines are turned off at night for example, then anything can happen. I also found that if one particular computer with Vista was the master browser on the workgroup, nothing worked. If an identical Vista machine was master instead, everything worked fine! Sometimes it doesn’t make much sense at all.

      In any case, if LANscanner doesn’t detect a workgroup, or if there is a problem with a workgroup, the DOS commands called will simply echo the error to the command prompt window, and then it will carry on with scanning the next workgroup.

      The “System error 87 has occurred. The parameter is incorrect” can be caused by a number of problems – for example, see Vista – Problem accessing network shares. It seems to be a more generic error message, and I’ve never encountered it while using LANscanner on any of my machines.

      What OS(es) are you running LANscan.exe on? I test each revision on XP, Vista, and 7, both 32 and 64-bit. But I don’t have access to various network configurations, no Windows servers, etc… so my testing is not exactly thorough. Also, LANscanner assumes that you have a nice standard install with all the proper networking services running. It also assumes that you are running the tool on the hard drive where you have Windows installed.

      Hope this helps!

  9. RENATO
    March 22nd, 2010 at 14:24 | #13

    @Scottie
    My OS on 3 pc is Windows XP SB2 and SB3 (Italian language)
    The following are the lines i get:

    LANscanner v1.3 – ScottiesTech.Info

    Scanning LAN…

    NET VIEW..etc…
    system error 87

    PCPROF 192.168.0.4 MASTER
    PC-X 192.168.0.2 MASTER
    PC12-3456789012 192.168.0.3

    Press any key to exit…

    • March 23rd, 2010 at 09:24 | #14

      Can you post the exact output, with the “..etc..”?

  10. RENATO
    March 23rd, 2010 at 15:46 | #15

    @Scottie
    It’s only showing the format of the NET VIEW command…it is like this:
    ———————————————————————–
    LANscanner v1.3 – ScottiesTech.Info

    Scanning LAN…

    Sintassi del comando:

    NET VIEW
    [\\nomecomputer | /DOMAIN:[nomedominio]]
    NET VIEW /NETWORK:NW [\\nomecomputer]

    Errore di sistema 87.

    Parametro non corretto.

    PCPROF 192.168.0.4 MASTER
    PC-X 192.168.0.2 MASTER
    PC12-3456789012 192.168.0.3

    Press any key to exit…
    ———————————————————————–
    Hope you understand the few italian words. If you need help just ask me.
    Thanks for your help.

  11. March 23rd, 2010 at 18:05 | #16

    @RENATO

    What’s really weird is that it seems the “net view /domain:[workgroup]” command is failing, because “net view /domain” works fine when you type it in manually. Also, if “net view /domain” wasn’t working, you would get a much different error.

    So, what happens if you type: “net view /domain:WORKGROUP” (or whatever you call your workgroup)?

    I think this is where it’s failing, but I’m not sure why.

    Also, what is the output when you type: “nbtstat -A 192.168.0.4″ (or some other valid IP address on your network)?

    The workgroup names are not being displayed, and it is from the output of “nbtstat” that LANscanner gets the workgroup name for each computer that it lists.

    Hopefully the answers to these two questions will shed some light on the problem!

  12. RENATO
    March 24th, 2010 at 08:40 | #17

    @Scottie
    Here I am with the answers:
    ——————————————————————-
    NET VIEW /DOMAIN
    Dominio
    ——————————————————————-
    MS
    MSHOME
    Esecuzione comando riuscita.

    NET VIEW /DOMAIN:MS
    Nome server Note
    ———————————————————
    \\PCPROF PcXP-Professional
    Esecuzione comando riuscita.

    NET VIEW /DOMAIN:MSHOME
    Nome server Note
    —————————————————————-
    \\PC-X
    \\PC12-3456789012 PC
    Esecuzione comando riuscita.

    NBTSTAT -A 192.168.0.4
    Connessione alla rete locale (LAN):
    Indirizzo IP nodo: [192.168.0.2] ID ambito: []

    Tabella dei nomi NetBIOS del computer remotO

    Nome Tipo Stato
    ———————————————
    PCPROF UNICO Registrato
    MS GRUPPO Registrato
    PCPROF UNICO Registrato
    MS GRUPPO Registrato
    MS UNICO Registrato
    ..__MSBROWSE__. GRUPPO Registrato

    Indirizzo MAC = 00-00-E2-44-D4-F8

    ———————————————————————–
    LANscanner v1.3 – ScottiesTech.Info

    Scanning LAN…

    Sintassi del comando:

    NET VIEW
    [\\nomecomputer | /DOMAIN:[nomedominio]]
    NET VIEW /NETWORK:NW [\\nomecomputer]

    Errore di sistema 87.

    Parametro non corretto.

    PCPROF 192.168.0.4 MASTER
    PC-X 192.168.0.3
    PC12-3456789012 192.168.0.2 MASTER

    Press any key to exit…
    ———————————————————————–

  13. March 25th, 2010 at 16:26 | #18

    @RENATO

    Oh dear, it’s pretty obvious now what the problem is: LANscanner was written for English Windows. So, when it tries to parse the output and call new commands, it screws everything up.

    Unfortunately it doesn’t seem like it will be an easy fix since even the output of “nbtstat” appears to be different… there’s a whole column missing compared to the English version.

    Maybe if I get Italian Windows some day, I’ll make LANscanner multilingual!

  14. May 27th, 2010 at 22:01 | #19

    how can i output the results into a text file?

  15. May 28th, 2010 at 10:16 | #20

    @tt

    Click Start and type “cmd” and hit Enter to open a command prompt window.

    Then just run it from the command line with “>” like so:

    lanscan > output.txt

    You’ll have to wait a few seconds, and then press Enter since it pauses at the end of the output for when you run it normally in Windows. If you put lanscan.exe in a system dir like C:\Windows, you can run it from anywhere. You can also include the path for the output file like so:

    lanscan > C:\Users\Bubba\Desktop\output.txt

    When the text file appears on your desktop, hit enter in the command prompt window to exit.

  16. May 28th, 2010 at 13:59 | #21

    Scottie, thanks for the info and thank you for some good software. Much appreciated!!!

  17. Mik
    August 10th, 2010 at 17:21 | #22

    Is there any way to get this script to run across subnets without the use of a wins server?

    • August 10th, 2010 at 18:05 | #23

      I dunno. There isn’t any way that I know of, anyway!

  18. August 10th, 2010 at 22:38 | #24

    Thanks for this nice tool to find the master browser.
    Works fine on a Win XP in German (in ref to Renato’s post, March 23rd, 2010).

  19. August 10th, 2010 at 22:57 | #25

    @Hans
    … the tool shows the actual master browser (and probably some language specific error:

    Systemfehler 87 aufgetreten.

    Falscher Parameter.

    However, the tool does reveal the current master browser.

    When removing the master browser by simply turning it off, Windows Networking needs about one minute till a new Master browser has been elected.

    Is there a way to influence this selection process?

    • August 11th, 2010 at 12:05 | #26

      Check out the links on this EggHeadCafe.com page. I’ve never tried it with Windows, but the Linux Samba option described further down the page does work quite nicely.

  1. No trackbacks yet.