[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 -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 | awk '{print $NF}' | awk -F '.' '{print $1}'

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


More information about the samba mailing list