Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'An AppleScript to look up NetBIOS names' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
An AppleScript to look up NetBIOS names
Authored by: DevNull on Apr 02, '03 12:40:57PM

You don't need a WINS server to lookup a NETBIOS name with NMBLOOKUP (although it does speed up things if it is there). NMBLOOKUP will query your subnet if a NETBIOS server is not present. Therefore this hacked version of the script will not work for machines on another subnet. Here is a hacked version of the original script for users in this situation (say if you are in a workgroup without a NETBIOS server).

--get the NetBIOs name to lookup
set theInput to display dialog ¬
"Enter the NetBIOS name to look up (in uppercase):" default answer ¬
"SERVER" buttons {"Cancel", "OK"} default button "OK"

if button returned of theInput is "OK" then

set theServer to text returned of theInput

-- do a basic lookup and display the result in a dialog box
set theOutput to do shell script "nmblookup -T -R " & theServer
set moreOutput to display dialog theOutput buttons {"More Info", "OK"}

-- open the Terminal to provide a more detailed display if desired
if button returned of moreOutput is "More Info" then
tell application "Terminal"
activate
-- make room for a second window
set the position of the front window to {100, 22}
-- do a detailed lookup of the server's NetBIOS properties
do script "nmblookup -T -S -U " & myWINS & " -R " & theServer ¬
in the front window
set winHeight to the last item of (get the size of the front window)
--look up active shares on the server in a new window positioned below the first
do script "smbclient -L " & theServer
set the position of the front window to {100, (22 + winHeight)}
end tell
end if
end if



[ Reply to This | # ]