0

I'm trying to execute a Microsoft Exchange command using Powershell under a Python RPyC server. In my MS Windows 2012 Server, works fine, but in 2008 version, doesn't work.

This is part of my code:

...
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))
...

I've checked that in Windows 2008 Server is only possible to execute CMD commands via RPyC, like:

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

Some tip?

Junix
  • 195
  • 2
  • 13
  • I take it there's a good reason you're not using [PowerShell remoting](https://blogs.technet.com/b/heyscriptingguy/archive/2010/11/16/enable-powershell-remoting-to-enable-running-commands.aspx)? – pobrelkey Nov 12 '13 at 19:27
  • I'm trying to create a python script to run inside a linux box. – Junix Nov 12 '13 at 19:53
  • Have you tried running the PS command from cmd.exe in a desktop session directly on the 2008 box? Maybe you'll get some helpful error message. – noam Nov 14 '13 at 13:45

0 Answers0