Share this page : facebooktwitterlinkedinmailfacebooktwitterlinkedinmail
SC config

Syntax:

sc [ServerNameconfig [ServiceName] [type= {own|share|kernel|filesys|rec|adapt|interact type= {own|share}}] [start= {boot|system|auto|demand|disabled}] [error= {normal|severe|critical|ignore}] [binpath= BinaryPathName] [group= LoadOrderGroup] [tag= {yes|no}] [depend= dependencies] [obj= {AccountName|ObjectName}] [displayname= DisplayName] [password= Password]

 Note that there is no space between the parameter and equal”=”, but there is a space between “=” and the value.
 eg. sc config defragsvc start= auto. no space between start and =, one space between = and auto.

Parameters

ServerName   : Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format (“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   : Specifies the service name returned by the getkeyname operation.

type= { own | share | kernel | filesys | rec | adapt | interact   type= { own | share }}   : Specifies the service type.

Value

Description

own

The service runs in its own process. It does not share an executable file with other services. This is the default.

share

The service runs as a shared process. It shares an executable file with other services.

kernel

Driver.

filesys

File system driver.

rec

File system-recognized driver (identifies file systems used on the computer).

adapt

Adapter driver (identifies hardware items such as keyboard, mouse, and disk drive).

interact

The service can interact with the desktop, receiving input from users. Interactive services must be run under the LocalSystem account. This type must be used in conjunction with type= own or type= shared (for example, type= interact type= own). Using type= interact by itself will generate an invalid parameter error.

start= { boot | system | auto | demand | disabled } : Specifies the start type for the service.

Value

Description

boot

A device driver that is loaded by the boot loader.

system

A device driver that is started during kernel initialization.

auto

A service that automatically starts each time the computer is restarted and runs even if no one logs on to the computer.

demand

A service that must be manually started. This is the default value if start= is not specified.

disabled

A service that cannot be started. To start a disabled service, change the start type to some other value.

error= { normal | severe | critical | ignore } : Specifies the severity of the error if the service fails to start during boot.

Value

Description

normal

The error is logged and a message box is displayed informing the user that a service has failed to start. Startup will continue. This is the default setting.

severe

The error is logged (if possible). The computer attempts to restart with the last-known-good configuration. This could result in the computer being able to restart, but the service may still be unable to run.

critical

The error is logged (if possible). The computer attempts to restart with the last-known-good configuration. If the last-known-good configuration fails, startup also fails, and the boot process halts with a Stop error.

ignore

The error is logged and startup continues. No notification is given to the user beyond recording the error in the Event Log.

binpath=   BinaryPathName   : Specifies a path to the service binary file.

group=   LoadOrderGroup   : Specifies the name of the group of which this service is a member. The list of groups is stored in the registry in the HKLM\System\CurrentControlSet\Control\ServiceGroupOrder subkey. The default is null.

tag= { yes | no } : Specifies whether or not to obtain a TagID from the CreateService call. Tags are only used for boot-start and system-start drivers.

depend=   dependencies   : Specifies the names of services or groups which must start before this service. The names are separated by forward slashes (/).

obj= { AccountName | ObjectName } : Specifies a name of an account in which a service will run, or specifies a name of the Windows driver object in which the driver will run. The default is LocalSystem.

displayname=   DisplayName   : Specifies a friendly, meaningful name that can be used in user-interface programs to identify the service to users. For example, the subkey name of one service is wuauserv, which is not be helpful to the user, and the display name is Automatic Updates.

password=   Password   : Specifies a password. This is required if an account other than the Local System account is used.

sc start (stop)

Starts a service running.

Syntax

sc [ServerNamestart ServiceName [ServiceArguments]

sc query

Obtains and displays information about the specified service, driver, type of service, or type of driver.

Syntax

sc [ServerNamequery [ServiceName] [type= {driver|service|all}] [type= {own|share|interact|kernel|filesys|rec|adapt}] [state= {active|inactive|all}] [bufsize= BufferSize] [ri= ResumeIndex] [group= GroupName]

For more see here.