是否可以从 cPython 运行 PowerShell 和 Active Directory 命令?

发布于 2024-12-19 08:36:28 字数 143 浏览 3 评论 0原文

我有 2 个关于 cPython(但不是 IronPython)的问题:

  1. 是否可以从 cPython 运行 PowerShell 命令?
  2. 是否可以从 cPython 运行 Active Directory 命令?

I have 2 questions about cPython (but not IronPython):

  1. Is it possible to run PowerShell commands from cPython?
  2. Is it possible to run Active Directory commands from cPython?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

那伤。 2024-12-26 08:36:28

取决于“运行命令”的含义。

Active Directory 可以通过 LDAP(使用像 python-ldap 这样的包)进行交互,或者,如果必须的话,您可以随时使用 Python 的许多过程控制库中的一个直接调用第三方“命令”(例如 subprocess

In [4]: subprocess.call('hostname')
rafael-imac.h.xxxxx.zzz
Out[4]: 0

我希望这会有所帮助。

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)

In [4]: subprocess.call('hostname')
rafael-imac.h.xxxxx.zzz
Out[4]: 0

I hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文