To run an application as a privileged service, create an object for it in the directory and make sure you can run it as a service of Windows NT Server.
To run your application as a privileged service
Create a Mailbox-Agent object for the service in the Microsoft Exchange Server directory. To do this, import a Mailbox-Agent object with a call to the DAPIWriteor BatchImport function.
Load the service by calling the HrInstallService function, which writes information about the service into the Windows NT Registry.
Create and configure a profile for the service.
A Windows NT Server administrator must assign the Log on as a service right to the Windows NT account belonging to the service. It is not necessary to give administrator privileges to the service on Windows NT Server.
A Microsoft Exchange Server administrator must grant administrator privileges to the service for the Microsoft Exchange Server site in which the service will operate. The application must have these permissions for access to multiple mailboxes.