[Samba] any reliable way to discover Windows hostname over SMB2+?

Rowland Penny rpenny at samba.org
Thu Jul 13 16:19:03 UTC 2017


On Thu, 13 Jul 2017 11:04:30 -0500
Andrew Walker via samba <samba at lists.samba.org> wrote:

> I forgot to mention in the previous email that smbclient works over
> SMB2. You just have increase the max protocol by adding the flag "-m
> SMB2".
> 
> I.e. "smbclient -m SMB2 -L 1.2.3.4 -N -d10 2>&1|grep AvNbComputerName"
> 
> rpcclient is potentially a more efficient way to get this information.
> 

I take it as you are talking about smbclient, this is on a Unix
machine, so how about:

host -i 192.168.0.2 | awk '{print $NF}' | awk -F '.' '{print $1}'

If you want the FQDN, just remove the last part.

Rowland



More information about the samba mailing list