# Service_GetState

> Gets state of specified service.

Source: https://docs.capaone.com/capainstaller/vb-scripting-library/service-functions/service-getstate/  
Product: CapaInstaller — a separate CapaSystems product; do not apply this page to any other.

### Description

Gets state of specified service

### Syntax

Service_GetState(sServiceName) As Boolean

### Parameters

#### sServiceName (String)

Name of service

### Return value

Result will be stored in gsValue. Service Controller Status constants

### Example

**VBScript**

```vb
If bStatus Then bStatus = Service_GetState("Service")
If bStatus Then bStatus = Job_WriteLog("Custom", "gsValue: " & gsValue, bStatus, True)
```

[Scripting Guidelines](/capainstaller/vb-scripting-library/scripting-guidelines/)

### Related functions

[Service_Exist](/capainstaller/vb-scripting-library/service-functions/service-exist/) [Service_SetLogonInformations](/capainstaller/vb-scripting-library/service-functions/service-setlogoninformations/) [Constants](/capainstaller/vb-scripting-library/addendum/constants/) [Package Property](/capainstaller/vb-scripting-library/addendum/package-property/) [Variables](/capainstaller/vb-scripting-library/addendum/variables/)
