Skip to Content

Get your services under control

Everybody knows performance matters. So today I am going to show you a way to improve yours. Hence you installed a Netweaver Composition Environment on your system and you are doing development or testing with it on your desktop box. Then you might want your needed services for instance the database and xserver service up and running whenever you need them. By default this is no problem because all required services are configured to start at windows boot. This means they are running whether you need them or not. So you don’t want these services to start every time, right? The pain way to go now is to manually stop them. Why would I do that you may ask? For example you just want to surf or do some Power Point and Office stuff and these services are consuming your hard earned money, well I mean system resources of course. Okay in case of Office and surfing you wouldn’t notice a big difference but if you do a performance critical task every byte of RAM is really welcome and by the way why should a process run when it is not needed. So the goal of this post is to teach a way to manage these services on demand, start them when they are needed and stop them when they are not needed. This can be done by a short and smart windows command line script.

But enough about the scenario lets come to the tutorial part. Some prerequisites are required before we can start. First of all you need an installed Netweaver CE version on your system. The trial version I used is available here at the SDN under the download section I used the Netweaver CE 7.1 SP3 trial version. So get it, install it and run it. To me this was pretty simple. The only issue I ran into was starting the sapinst.exe without administrator rights which lead to an error but after fixing that everything worked out very smoothly and without any further problems. The next thing you need to know is your SAP system ID which you entered during the installation process. In my case I left it to the default which was CE1, the same with the Database ID which is also CE1 by default. And last but not least you need your instance and SCS instance number. If you didn’t change anything and don’t have any other instances running on your system this should be 00 as instance number and 01 as SCS instance number.


Ok let’s go:


Step 1: Fulfill the prerequisites


Prerequisite summary:

  • installed Netweaver CE
  • SAP system ID (CE1 in my case)
  • Database ID (also CE1 in my case)
  • Instance number (00 in my case)
  • SCS instance number (01 in my case)


If you don’t have this information don’t worry I show you later on how to get it.

So now it is time to navigate to the windows service administration tool. You can do this by click on “start” button in your windows taskbar then click on “run” and type in the input box: “services.msc” finally hit enter. The windows service administration tool should show up.


Step 2: Identifying the relevant services


In this solution I am talking about 5 services:

  • SAPCE1_00
  • SAPCE1_02
  • XServer

The names could differ from yours depending on your instance number and your system ID. The above mentioned are the default names which are given when you didn’t change anything during your installation.

If you don’t know your names just look after services which are named similar to mine in your service explorer.


Picture one shows you the MAXDB CE1 service and its properties. Just right click on the service and click the properties menu item. The popup with the details comes up. The red marked field is the exact name of the service. Write the name down you will need it later for the script. Note: Case sensitivity and whitespaces are relevant.

 Figure 1

In the second picture you see that the “SAP DB WWW”, “SAPCE1_00”, “SAPCE1_01”  and the  “xserver” services which are set to startup type automatic. Repeat what you have done with the MAXDB CE1 service to find out their real names.

 Figure 2

Step 3: Configuring the services

The third picture shows you the properties view of the SAP DB WWW service. As you can see its startup type is still set to Automatic. Click on the drop down box and change it to manual after that hit the stop button to shutdown the service.


Figure 3 


Now your service properties view should look like shown in picture four. Repeat that above process mentioned on picture three on all other services.


Figure 4



Step 4: The fun part: scripting the bat file


First of all the script does two things:

  • It starts the services and goes into a waiting loop. (The loop is interrupted if you hit any key within the open command line window.)
  • Then (after pressing a key) the script stops the services which where preliminary started. (after that again by pressing a key the window close)

Important notes for the right usage of this script:

  • Don’t close the command line window as long as you wanted the services to run.
  • Don’t just close it follow the procedure by pressing keys inside the window
  • You have to trigger the start of the engine by yourself either using the MMC or the sapconsole. The script only starts the services which are needed for a correct engine start.
  • If you didn’t stop the services before you run the script an error will occur during execution saying that there is already an instance of this process running.

What you have to do now to use this script is copy and paste the script into a new file on your desktop. The filename should end with .bat so windows will automatically identify it as an executable. Then replace every occurrence of: SAPDBWWW, SAP DBTech-CE1, XServer, SAPCE1_00 and SAPCE1_01 with the notes you have written down in Step 2. Once you have done this you are finished and ready to run it.


I think the script is mainly self explanatory because there is no great magic inside. There are only five different commands used:

  • rem (prints a comment to the window)
  • echo (prints a message to the screen, echo. Prints a blank line followed by the service name)
  • sc (service control command: used parameters are start and stop)
  • pause > nul (waits until a key is pressed)
  • cls (clears the current screen)

Now here is the script:


rem SAP CE1 Start Services…

@echo off


echo Starting Database Services …

            sc start SAPDBWWW

            sc start “SAP DBTech-CE1”

            sc start XServer


echo Starting SCS Service …

            sc start “SAPCE1_00”


echo Starting Application Server Service …

            sc start “SAPCE1_01”


echo Important please read with care !!!


echo “Note: You have to trigger the start of the engine manually

echo either using MMC or sapcontrol”


echo “Press any key to stop the the services and close this window.

echo Please stop the engine before manually!”


pause >nul


echo Stopping Application Server Service

            sc stop SAPCE1_00


echo Stopping Database Services

            sc stop SAPDBWWW

            sc stop “SAP DBTech-CE1”

            sc stop XServer


echo Stopping SCS Service

            sc stop SAPCE1_01


echo “Press any key to close this window”

pause >nul

@echo on

1 Comment
You must be Logged on to comment or reply to a post.
  • Hi Simon

    It might be useful to set some variables at the start of the script:

    SET SCSnode=01
    SET CInode=00

    etc and then use them in the rest of the script as %SID% etc. Makes for better readability.

    Also, I think that the MC plugin (http://host:5xx13) is a better, more platform independent method for accessing SAPcontrol.