Are there Python equivalents for the net ads command?

Andreas Schneider asn at
Wed Sep 2 07:33:57 UTC 2015

On Thursday 13 August 2015 15:25:51 Richard Sharpe wrote:
> On Thu, Aug 13, 2015 at 2:58 PM, Andrew Bartlett <abartlet at> wrote:
> > On Thu, 2015-08-13 at 12:55 -0700, Richard Sharpe wrote:
> >> Hi folks,
> >> 
> >> Do these commands exist as Python commands at all?
> >> 
> >> There are so many Python weenies around that it is becoming necessary
> >> to have the whole lot available in Python.
> > 
> > While a significant part of what net ads does can be done with the
> > python bindings we supply out of the source4 effort, there isn't a
> > direct one-to-one connection.  It would be good to add such bindings,
> > see how pynet wraps the source4 libnet.  Something similar to 'net ads
> > join' can actually be done using the python join code in
> >, for example, but this will join using the old samba4
> > member code.
> > 
> > That will write out a secrets.tdb along with the secrets.ldb, but it
> > would be better if the same code (source3/libnet) as 'net ads join' was
> > wrapped instead.
> > 
> > Other tasks that just involve ldap queries could be handled directly in
> > python.
> OK, I will have a think about that. We use a very large amount of
> Python here that I am becoming a Python weenie.
> Life would be so much easier if we had Python bindings or wrappers and
> could throw Python exceptions ... although, getting them into
> protobufs are another issue.

'net ads' used libnetapi, so you might want to create python bindings for 

See source3/libnet/ which is totally undocumented. Doxygen for that API would 
be nice ...

Andreas Schneider                   GPG-ID: CC014E3D
Samba Team                             asn at

More information about the samba-technical mailing list