Using prunsrv to create a service

Connector installers do not create automatically service in Windows.
You can create a service by using a third party utility, released by Apache, called prunsrv.

1. Download and extract procrun (prunsrv.exe and prunmgr.exe utilities)

You can find the procrun utilities in the package commons-daemon (current version "") that is available on the Apache daemon binaries for windows page.

Extract the package and copy prunsrv.exe (32 or 64 bit, depending on your Windows environment) and prunmgr.exe in the connector folder.

connector installation folder with procrun utilities


2. Run the command line to install the service. 

The command should be as follows.
Please check all the parameters that you have setup with run.bat file to run the connector.
This is also documented on the "Administration Guide for Google Connectors" on the paragraph "Run a connector as a service on Windows".

This example is used for the SharePoint connector, with additional JvmOptions parameters to setup the the KeyStore and trustStore SSL.

prunsrv install sp_adaptor_GOOGLE ^
--Classpath=C:\SP_ADAPTOR_GOOGLE\adaptor-sharepoint-4.0.4-withlib.jar ^
--StartMode=jvm ^
--StartMethod=serviceStart ^ ^
--StopMode=jvm ^
--StopMethod=serviceStop ^ ^
--StdOutput=stdout.log --StdError=stderr.log ^
--Jvm="C:\Program Files (x86)\Java\jre7\bin\client\jvm.dll" ^
--Startup=auto ^ ^ ^ ^ ^

Command Line to create the service using prunsrv


3. Check that the service has been created in Windows.

Open the Windows Services Snap-in (services.msc) and check that the SharePoint connector service has been created correctly.
In case of any error, you can still revert the changes, deleting the service using the command prunsrv delete sp_adaptor_GOOGLE.

Windows srevices snap-in

Do not run the service yet after its creation.


4. Rename prunmgr.exe

For easier management, rename prunmgr.exe to the service name you have just created (sp_adaptor_GOOGLE.exe)

prunmgr.exe renamed to connector


5. Check all the service settings with prunmgr.exe

Run the just renamed sp_adaptor_GOOGLE.exe (originally prunmgr.exe) and check all the tabs for the service settings. Some might be inserted manually or changed.







6. Configure the Log On tab

Setup the logon username with the one allowed to access SharePoint server, in this example is "DOMAIN\googlesp".
You will need to insert the password just to create the service in windows that will authenticate as usual with Windows. 
It will not be logged by the connector. You can verify this with your Windows Administrator.



7. Run the service.


8. Troubleshooting

a) Service is not starting and you can find a "Incorrect function" error message logged in Windows Event Viewer.
Please check that:
- prunsrv is installed for the correct architecture: 32 or 64 bit depending on Windows architecture
- when running the command line (at paragraph 2), path and options are double quoted when contains space
- check that JVM parameter refer to the correct JDK/JRE installation
- logfiles folder, stdout.out and stderror.out logfiles, must be accessible for writing

Was this helpful?
How can we improve it?