Service Commands

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > NT Service commands >

Service Commands

ISC. -  If Service Condition

Previous Top Next


MiniRobotLanguage (MRL)

 

ISC. Conditional Statement

If Service Condition

 

 

Intention

 

This command can be used to manage System Services. You can check almost all conditions of system services. If they are installed, running or not. You can check the Starting Mode of a service and much more.

 

To specify a service you will need to give the "service name". Please see

How to get the proper service name

on which choices you have to specify the service you want to deal with, in a way that it will really work for you, as expected.

 
ISC. / NSC.  support textual state, these are:

 

"stop","stopped"       = 1

"start pending"        = 2

"stop pending"         = 3

"running","run"        = 4

"continue pending"     = 5

"pause pending"        = 6

"pause","paused"       = 7

 

If you use textual Run-States please do only specify one Run-State.
If you use numeric run-states, you can specify multiple Run-States.

For example:

 

 ISC.sta|dn:yah||2,4,3

but

 ISC.sta|dn:yah||running

 

 

Syntax

 

ISC.P1|P2[|P3][|P4][|P5]

 

Details of the parameters depend on the used Subcommand, see below.

 

Parameter Explanation

 

P1 - Subcommand

 

'  Check the "running state" of a service

 "sta" or "state" or "any state"

   Evaluate, if the "running state" of the service P2 (you must specify the service name)

  is equal to the state given in P4. For P4, you can specify a numeric value or a textual

   parameter like these: !Service Commands

   You can specify multiple values if they are separated with ",", like this:

   

 ISC.sta|dn:yah||2,4,3

 

  ' Example:

 ISC.sta|dn:yah||stop

    DBP.Service is stopped.

 ELS.

    DBP.Service is not stopped

 EIF.

 

 ISC.sta|dn:yah|||2,4

 

 

'  Check the "running state group" of a service

 "stg" or "state group"

   Evaluate, if the "running state" of the service P2 (you must specify the service name)

  is equal to the state given in P4. For P4, you can specify a numeric value or a textual

   parameter, details see !Service Commands

 

  ' Examples:

 ISC.stg|dn:yah||stop

    DBP.Service is stopped or stop is pending.

 ELS.

    DBP.Service is not stopped, and stop is not pending

 EIF.

 

 

'  Check for multiple "running state" of a service

 "ans" or "any state"

   Evaluate, if the "running state" of the service P2 (you must specify the service name)

  is equal to the state given in P4. For P4, you can specify a numeric value or a textual

   parameter like these: !Service Commands

 

' Examples:

' Service may not have any of these states

 NSC.ans|dn:yah||2,3,4

    DBP.Here

 EIF.

 

' Service should have any of these states

 ISC.ans|dn:yah||2,3,RUN

    DBP.Here

 EIF.

 

 

 

' Check the start mode of a service

 "sm" or "start mode"

  Evaluate the "Start Mode" of a specified service and compare with a specified

   start-Mode P4. P4 can be a number from 2 to 4 or a phrase.

  See a list of all numbers, phrases and their meanings here: !Service Commands

 

' Examples:

ISC.sm|dn:yah||demand

  DBP.Start Mode is "on demand"

ELS.

  DBP.Start Mode is not "on demand"

EIF.

DBP.$$000

ENR.

 

Further tests:

 

"run","running"

Test if Run State is 4 (RUN)

ISC.run|NetLog

 

"stop","stopped"

Test if Run State is 1 (STOP)

ISC.stop|bdsvc

 

"pau","paused"

Test if Run State is 7 (PAUSE)

ISC.pau|servicename

 

"dis","disabled","deaktiviert"

Test if Start-Mode is 4 (disabled)

ISC.dis|Logon

 

"auto","automatisch","autostart"

Test if Start-Mode is 2 (AUTO)

ISC.auto|sn

 

"manuell","demand","on demand"

Test if Start-Mode is 3 (on demand)

ISC.demand|sn

 

"pen","pending"

Test if the service Run State is in any

"Pending State". These are any of the states:

"Start pending", "Stop pending", "Continue pending" or

"Pause pending".

ISC.pen|sn

 

"pen-sta","start pending"

Test if the service is "Start pending" or "Continue pending"

ISC.pen-sta|sn

 

"pen-sto","stop pending"

Test if the service is "Stop pending" or "Pause pending"

ISC.pen-sto|sn

 

 

P2 - Service-Name

 

P3 - Computer-Name or empty. In that case the local computer is used.

 

P4 - (optional) Meaning of P4 depends on used Subcommand.

 

What happens in case of an error?

If the specified service is not found, the Error-Message "Error: No such service." is been placed on TOS and the condition is evaluated to FALSE..

In case there are other errors during the processing of the command, the error-message is been placed on TOS and the condition is evaluated to FALSE.

The error-message will always be prefixed with an "Error: " to indicate that it is an error from the services-engine.

Here is an example for such an error-message:

"Error: The requested access to the services database was denied."

 

 

 

Example

 

'**********************************

' ISC.

'**********************************

ISC.sm|dn:yah||demand

  DBP.State is

ELS.

  DBP.State is not

EIF.

' Display Error if we got one

DBP.$$000

ENR.END.

'**********************************

 

'**********************************

' ISC.

' Error - will be displayed

'**********************************

ISC.sm|dn:yahs||demand

 DBP.State is

ELS.

 DBP.State is not

EIF.

' We'll see the error that the service does not exist.

DBP.$$000

ENR.

 

 

 

Remarks

 

-

 

 

 

Limitations:

 

-

 

 

See also:

 

    !Service Commands

    SER. - Service Command

    WSC. - Wait Service Command

    ISI. / NSI. - If Service Installed

    FES. - For Each Service