I know this is an old post, but I thought I would post my answer. I did this in a .net 4 service using the BeforeInstall event.
ServiceProcessInstaller BeforeInstall event:
private void serviceProcessInstaller1_BeforeInstall(object sender, InstallEventArgs e) { System.ServiceProcess.ServiceProcessInstaller installer = sender as System.ServiceProcess.ServiceProcessInstaller; if (installer != null) {
The installed service is as follows: 
It works fine, and I can check the parameters from the main function of the service.
Jeremy Sep 17 '15 at 20:07 2015-09-17 20:07
source share