Sunday, April 17, 2011

How to restart BPC service automatically using scheduler (Microsoft platform)

Sometimes BPC system needs to be restarted whatever the reason is.

Here is what we should restart. (Note: it should be done sequentially.)

1. Stop 'Send Governor' service

2. Stop BPC component services (Please see below screen shot how to stop it manually)

image

3. Stop and Start IIS (Internet Information Services

4. Start 'Send Governor' service

As we know step1, 3 and 4 can be done command.

Here is command for executing above steps.

1. net stop "Outlooksoft Sendgovernor service"

3. IISRESET

4. net start "Outlooksoft Sendgovernor service"

But there is no command for stopping BPC component in the component services.

One of BPC customer wanted to do this so I created simple script that can stop all component service's component. (Note: it will stop all component so if customer is using other component, it needs to be modified to avoid stopping.)

Here is source code.

=====================================================

Set adminCatalog = CreateObject("COMAdmin.COMAdminCatalog")

'getting all the Applications in the server

Set objAppCollection = adminCatalog.GetCollection("Applications")

    objAppCollection.Populate
    'loop for all application
    For i = 0 To objAppCollection.Count - 1

        Wscript.echo objAppCollection.Item(i).Name
        'Shutdown app
         adminCatalog.ShutDownApplication objAppCollection.Item(i).Name
    next 

set objAppcollection = Nothing
set adminCatalog = Nothing

=====================================================

Let's assume user saved above source code as 'RestartCom.vbs'.

Now we can create a batch file - let's say it is ResetBPC.bat -  that can be scheduled using windows scheduler.

Below four lines of source code is content of ResetBPC.bat file.

----------------------------------------------------------------------

net stop "Outlooksoft Sendgovernor service"

Cscript c:\restartcom.vbs

IISRESET

net start "Outlooksoft Sendgovernor service"

----------------------------------------------------------------------

The customer who asked it to me satisfied its result using this script.

They could restart BPC service during night time without manual procedure.

I think it also will help other customers who have same concern and save time all SAP colleagues and partner consultants.

If you have any questions, please leave comments.

No comments:

Post a Comment