Are there Python3 libraries for the net commands and etc?
David Mulder
dmulder at samba.org
Tue Mar 29 19:20:53 UTC 2022
On 3/28/22 1:44 PM, Richard Sharpe via samba-technical wrote:
>
> smb_mgmt_net_ads_join/smb_mgmt_net_ads_leave
These already have bindings. See the python module `samba.net_s3`.
> smb_mgmt_net_ads_status
This appears to just do an ldap search for the local host, to see info
about the join?
You could write something similar using the samba.samdb python module.
So,
```
from samba.samdb import SamDB
from samba.auth import system_session
samdb = SamDB(url='ldap://some-server', session_info=system_session(),
credentials=creds, lp=lp)
samdb.search(...)
```
The net ads status command searches for these attributes:
"objectClass",
"SamAccountName",
"userAccountControl",
"DnsHostName",
"ServicePrincipalName",
"userPrincipalName",
"unicodePwd",
"msDS-AdditionalDnsHostName",
"msDS-SupportedEncryptionTypes",
"nTSecurityDescriptor",
"objectSid"
With the filter: `"(samAccountName=%s$)" % machine_name`
> smb_mgmt_net_conf_list
> smb_mgmt_net_conf_setparm
We don't have bindings for these right now. It probably wouldn't be
difficult to add them though.
--
*David Mulder*
Labs Software Engineer, Samba
SUSE
1221 Valley Grove Way
Pleasant Grove, UT 84062
dmulder at suse.com
http://www.suse.com
More information about the samba-technical
mailing list