Will
Will

Reputation: 193

How can I create an Exchange mailbox in Exchange 2010 from Python / Perl

I'd like to create an Exchange mailbox for a newly created AD account from a tool that runs on Linux. Something I can directly call within Python or Perl would be ideal, but I could make a stub in something else if necessary. I do not want to use ssh, saltstack, etc. to directly or indirectly execute the PowerShell command directly.

I'd like to do something along the lines of this: Create exchange Mailbox from python

However, apparently, the CDO is now deprecated in favor of EWS / Outlook Object Model / MAPI. Most of the documentation I found for those involves client actions vs. administrative / management functions.

Obviously, it would be possible to make a stub web service on the Windows side of things that would execute the necessary PowerShell commands, but that's not an area where I have much experience, so I'm wondering if there's a more generic way to do this.

http://msdn.microsoft.com/en-us/library/ff326155.aspx mentions: "You can use the Exchange Management Shell to create two kinds of tools: command-line scripts that work within the Windows PowerShell environment, and tools that use the Exchange Management Shell cmdlets through a managed interface. You can use managed applications to create a standard Windows or web-based UI to administer an Exchange server."

http://msdn.microsoft.com/en-us/library/jj190904%28EXCHG.150%29.aspx does seem to imply that you can run cmdlets via EWS:

"EWS for Exchange Online versus Exchange on-premises" [...] * Exchange Management Shell cmdlets – Exchange Online supports a different set of cmdlets than Exchange on-premises.

From what I can gather, I don't think using Mono to do this will work. I do have a decent amount of PowerShell experience, but no specific C# programming expertise.

If there's no way to do this easily, the Windows folks can write something in PowerShell that will run every few minutes and create the mailbox for newly created accounts, but seems to me like there should be a simpler way.

Lastly, we will be running in hybrid mode for a while, but we are planning on using Office365. As best I can tell, PowerShell is the only way to create mailboxes in Office365 (sorry, can't post the link, since I already have 2 here) Anyone have any news on that?

Upvotes: 1

Views: 1251

Answers (1)

Serjx86
Serjx86

Reputation: 530

AFAIK, the only organization management APIs Microsoft exposes for Office 365 work via PowerShell. Both MSOL module for Azure AD management and remote PowerShell for Office 365 Exchange side. I do not believe we will see a PowerShell interpreter with WinRM server and WSMAN support on non-Microsoft OS. I did hear of the rumors of RESTful API in Office 365 for organization management, but I would not count on it.

From practical standpoint I'd suggest deploying an app, a RESTful service per chance, on a Windows box equipped to connect to Exchange and AD. Have this app do the dirty work and give it authenticated commands from the Linux process.

Upvotes: 1

Related Questions