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 can't seem to figure out how, using one of the above event types (a .NET, WMI or engine event), I might be able to subscribe to the event that is raised on the creation of a new mailbox in Exchange Server 2010. To be more specific, I'm simply trying to figure out what event I need to subscribe to. Along these lines, I was hoping someone might be able to point me in the right direction as to where I could find more details on which events I can subscribe to in Exchange Server 2010 and the args that are passed when the event is raised.
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 execute PowerShell scripts in their environment at this time (PowerShell 2.0). Ideally I would like to have the -Action parameter execute a block of code that makes a call to my API notifying me that a new mailbox has been provisioned.
I am a .NET developer but I am new to working with Exchange and fairly new to working with PowerShell especially in this context. I can work out the scripts/code myself, but I would like to figure out if I can even subscribe to a new mailbox event before I go too far down this path.
Any help here would be greatly appreciated!
I'm not aware of Exchange raising any event in any of those contexts. Do you have access to the actual Exchange servers, or are you just a tenant?