Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/316.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过Python rpyc在Wndows服务器远程exchange命令中运行_Python_Powershell_Exchange Server_Rpyc - Fatal编程技术网

通过Python rpyc在Wndows服务器远程exchange命令中运行

通过Python rpyc在Wndows服务器远程exchange命令中运行,python,powershell,exchange-server,rpyc,Python,Powershell,Exchange Server,Rpyc,我正在尝试在Python RPyC服务器下使用Powershell执行Microsoft Exchange命令。 在我的MS Windows 2012服务器中,工作正常,但在2008版本中,不工作 这是我代码的一部分: ... try: conn = rpyc.classic.connect(server) except: print "[ERROR] Unexpected error:", sys.exc_info()[0] conn.modules.os.popen("pow

我正在尝试在Python RPyC服务器下使用Powershell执行Microsoft Exchange命令。 在我的MS Windows 2012服务器中,工作正常,但在2008版本中,不工作

这是我代码的一部分:

...
try:
    conn = rpyc.classic.connect(server)
except:
    print "[ERROR] Unexpected error:", sys.exc_info()[0]
conn.modules.os.popen("powershell.exe -profile -nointeractive \"& \"Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010; New-organization -name %s -DomainName %s -ProgramId Infoplan01 -OfferId 6 -location en-US -AdministratorPassword %s\"" % (domain, domain, passwd))
...
我已经检查过,在Windows 2008中,服务器只能通过RPyC执行CMD命令,如:

conn.modules.os.popen("dir")

一些提示?

我认为您不使用它有一个很好的理由?我正在尝试创建一个python脚本,以便在linux设备中运行。您是否尝试过在桌面会话中直接在2008设备上运行cmd.exe的PS命令?也许你会得到一些有用的错误信息。