[Samba] net ads status stripped output

Rowland penny rpenny at samba.org
Thu Jun 4 09:59:46 UTC 2020

On 04/06/2020 10:53, Markus Lindberg wrote:
>> ldbsearch -H ldap://$(host -t SRV _ldap._tcp.pdc._msdcs.$(hostname -d) |
>> awk '{print $NF}') -P "(sAMAccountName=$(hostname -s)\$)"
>> distinguishedName | grep 'distinguishedName' | awk '{print $NF}'
>> It will involve installing ldb-tools
> Thanks I guess I can use `net ads search` as well, like this for
> example.
> net -P ads search "(&(objectCategory=computer)(cn=$(hostname)))" | sed -ne 's/distinguishedName: //p'
> Or is this not a recommended tool to use?
> --
> Markus

I don't see why you couldn't use that, it produces the same output as mine.

Isn't Linux wonderful, numerous ways of doing the same thing ;-)


More information about the samba mailing list