Creating an OpenOffice.org Service on Windows

Creating a Windows Service lets you have an OpenOffice.org instance always running as a service and listening for connections. That's what you usually want to do on a server machine. Here is one way to create a Windows Service: use the SRVANY utility that you can download for free as part of the Resource Kit. (This was done on an XP SP2, YMMV.)
  1. I assume you already installed OpenOffice.org and started at least once under the current user
  2. Download and install the Windows Server 2003 Resource Kit Tools
  3. Read How To Create a User-Defined Service
  4. Create a service named OpenOfficeUnoServer following the instructions above; as the Application registry value use C:\Program Files\OpenOffice.org 2.0\program\soffice.exe
  5. Add another value to the Parameters key named AppParameters and set it to -headless -accept=socket,port=8100;urp;
  6. From Control Panel / Administrative Tools / Services open the Properties for the new service and change the Log On account to be Local Service which is a more secure option than SYSTEM
  7. If we stop here the service will start but not actually work. That's because the service runs as a special account and OpenOffice.org will try to show the license agreement dialog as if it was a new user instead of starting the application. To avoid this, you need to edit share\registry\data\org\openoffice\Setup.xcu (it's an XML file) inside the OpenOffice.org installation directory and replace this bit
    <prop oor:name="ooSetupInstCompleted">
      <value>false</value>
    </prop>
    <prop oor:name="ooSetupShowIntro">
      <value>true</value>
    </prop>
    with this other one (replace the date with today's date; it must be later than the OOo installation time)
    <prop oor:name="ooSetupInstCompleted" oor:type="xs:boolean">
     <value>true</value>
    </prop>
    <prop oor:name="LicenseAcceptDate" oor:type="xs:string">
     <value>2006-07-25T17:34:04</value>
    </prop>
    <prop oor:name="FirstStartWizardCompleted" oor:type="xs:boolean">
     <value>true</value>
    </prop>
  8. Start your new service (e.g. from Control Panel / Administrative Tools / Services)
  9. You may need to unblock the new service at the firewall level
  10. From a command prompt do
    > netstat -anp tcp
    this should show a listening on port 8100. Chances are that the service will only listen on the 127.0.0.1 interface; this means you can only connect from the same machine and it's good from a security point of view. However, if you want to be able to connect from other machines as well you need to change the accept string to "socket,host=0.0.0.0,port=8100;urp;" in the AppParameters registry value