Using WASService

I keep getting asked how to automatically start WebSphere Application Server (WAS) server instances upon restart of the Windows Server.

To do so there is a nice little tool provided with WAS called WASService which adds the server instance as a Windows service:
Bildschirmfoto2010-03-10um09.25.12.png

So for example, to add a service called “lcMisc“ based on a server definition “lcMisc” you would add it like this:
Bildschirmfoto2010-03-10um09.25.40.png

The credentials specified with -userid define the local or domain user account who will be used to start the service.

NOTE: When WAS admin security is enabled you need to provide that information with -stopArgs. Otherwise you won’t be able to stop the server through Services.msc.

When looking at Services.msc you should see the service you have just created:
Bildschirmfoto2010-03-10um09.13.58.png

You can also use WASService to remove the service:
Bildschirmfoto2010-03-10um09.25.55.png

NOTE: When you need to update the configuration of the service (e.g. changed credentials), just re-use the -add command as shown above with the changed information.

The configuration of the service is stored in Windows registry in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\, for example:
Bildschirmfoto2010-03-10um09.36.42.png

Bildschirmfoto2010-03-10um09.35.35.png

OPTIONAL: Sometimes you need to start services in a specific order, let’s say database first and WAS server second. To do so, please follow the instructions on How to delay loading of specific services in the Microsoft Knowledge Base.

Basically, you need to add a value called “DependOnService” with a data type of REG_MULTI_SZ to the service definition and add the name of the service it depends on as the data of that value. For example:
Bildschirmfoto2010-03-10um09.35.56.png

NOTE: As this value is of type REG_MULTI_SZ you can provide more than one service name (each on a separate line).

In the following example, “nodeagent” needs DB2 and Lotus Domino to be started while itself is a pre-condition for “lcApps” and “lcMisc” services.

Bildschirmfoto2010-03-10um11.09.31.png

NOTE: You can’t modify these dependencies in Services.msc, you have to modify the Windows registry instead.