The WASService.exe command allows you to setup a Windows service for a WebSphere server. The command has its own idiosyncratic behavior. Best way to learn about the program is through actual examples.
Removing a Service
Removing a service seems pretty easy:
wasservice -remove SERVICE_NAME
What this command considers as service name is not same as Windows. A service has two names in Windows. A display name and service name. You can find out more about these names by running this Windows command
sc query state= all
Note: Notice the space after “state=”. Without the space, the command will fail.
WebSphere service names usually contain “IBM”. So, you can view all registered WebSphere services by running this command:
sc query state= all | findstr IBM
If Windows shows the service name (not the display name) as “IBMWAS70Service – myNode01”, then you need to use myNode01 as the service name for the wasservice command. That is, use the name after “-“. For example:
wasservice -remove myNode01
This is effectively same as running the command:
sc delete "IBMWAS70Service – myNode01"
Adding a Service
The example below will show you how to add a service that has administrative security enabled.
-profilePath C:WebSphere70profilesAppSrv01
-wasHome C:WebSphere70
-logRoot C:WebSphere70profilesAppSrv01logsserver1
-startType automatic
-stopArgs "-username wasadmin -password waspass"
This will create a Windows service called “IBMWAS70Service – myNode01” for WAS7 and “IBMWAS80Service – myNode01” in WAS8.
Note: that the entire stopArgs argument has to be within double quotes.