[英]Is it possible to run PowerShell and Active Directory commands from cPython?
I have 2 questions about cPython (but not IronPython): 我有2个关于cPython(但不是IronPython)的问题:
Depends what you mean by "run commands". 取决于“运行命令”的含义。
Active directory can be interfaced with via LDAP (with a package like python-ldap) or, if you must, you can always call third party "commands" directly using on of the many process control libs for python (like subprocess ) 可以通过LDAP(使用python-ldap之类的包)通过LDAP与Active Directory进行接口,或者,如果必须的话,您始终可以使用许多python的过程控制库中的on(例如subprocess )直接调用第三方“命令”。
In [4]: subprocess.call('hostname')
rafael-imac.h.xxxxx.zzz
Out[4]: 0
I hope this helps. 我希望这有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.