Question

We're trying to get SMB volume listings in our OS X application, and have been using NMBLookup, as suggested by Apple, to get listings. However, more often than not, we're not able to get a full listing of available SMB volumes using the tool. We've got a good benchmark in that we can see the full listing the Apple Finder gets, and the majority of the time, our listing is not matching up, usually missing servers.

We're tried a number ways of executing the command, but haven't yet found anything that brings us back a complete listing.

nmblookup -M -- -

nmblookup '*'

etc

Does anyone know what we could be doing wrong, or know of a better way to query for SMB volumes available on local subnets?

Was it helpful?

Solution

This work fairly well in our network. The point is to use smbclient -L on each of the entries returned by nmblookup:

nmblookup  -M -- - | grep -v querying | while read sw
do
echo $sw | awk -F' ' '{print $1}' | xargs smbclient -L 
done

Edit: @paul - now I see what you mean - a vista has just joined our network and the Finder shows it but not nmblookup, but smbclient shows it in the "Server" section.

smbclient has a "Server" section where it lists the machines found on the network. The command line I use is:

smbclient -L 192.168.0.4 //the IP as returned by nmblookup of the master browser

cristi:~ diciu$ smbclient -L 192.168.0.4
Domain=[DOMAIN] OS=[Unix] Server=[Samba 3.0.24-7.fc5]
    Sharename       Type      Comment
    ---------       ----      -------
    internal        Disk      some share
[..]
Anonymous login successful
Domain=[DOMAIN] OS=[Unix] Server=[Samba 3.0.24-7.fc5]

    Server               Comment
    ---------            -------
    MMM                  Vista box not showing up in nmblookup
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top