Using PowerShell, it is possible to subscribe to a .NET, WMI or engine event via Register-ObjectEvent, Register-WmiEvent or Register-EngineEvent, respectfully, and each of these cmdlets have an –Action parameter to which you can hand a block of code that is to be invoked when the event occurs. I'm not sure if this would be the appropriate mechanism to do this, but the goal would be to be able to run some C# code that would make a call to an API when a new mailbox is added in Exchange.
To provide some context here, I have a cloud based mail service that needs to know how many users a given organization is using. Doing something like an AD sync is not an option. I have access to the Exchange Server 2010 server during the initial provisioning of the service and I will be able to remotely execute PowerShell scripts against Exchange (I should be able to access AD, as well, via Exchange) during that initial provisioning.
Any help here would be greatly appreciated. I think the biggest difficulty here is finding the event I would need to hook into. There's no sense in my exploring this any further if I can't hook into that New-Mailbox event and execute some code off of that event.
No comments:
Post a Comment