Windows config service что это

Команда SC – управление службами.

Команда SC используется для конфигурирования, опроса состояния, остановки, запуска, удаления и добавления системных служб в командной строке Windows. Большая часть подкоманд команды SC применима так же по отношению к драйверам. При наличии соответствующих прав, команда SC может применяться для управления службами как на локальной, так и на удаленной системе.

Формат командной строки:

sc сервер [команда] [имя службы] параметр1 параметр2 .

При запуске SC.EXE без параметров, отображается подсказка по использованию команды.

сервер — имя или IP-адрес удаленной системы в формате «\\cервер».

query -Запрос состояния службы или перечисление состояний типов служб.

queryex — Запрос расширенного состояния службы или перечисление состояний типов служб.

start — Запуск службы.

pause — Отправка службе управляющего запроса PAUSE для приостановки ее работы.

interrogate — Отправка службе управляющего запроса INTERROGATE.

continue — Отправка службе управляющего запроса CONTINUE для возобновления ее работы.

stop — Отправка службе запроса STOP.

config — Изменение конфигурации службы (постоянное).

description — Изменение описания службы.

failure — Изменение действия, выполняемого службой при сбое.

failureflag — Изменение флага действия, выполняемого службой при сбое.

sidtype — Изменение типа SID службы.

privs — Изменение привилегий, требуемых для службы.

qc — Запрос данных конфигурации для службы.

qdescription — Запрос описания службы.

qfailure — Запрос действия, выполняемого службой при сбое.

qfailureflag — Запрос флага действия, выполняемого службой при сбое.

qsidtype — Запрос типа SID службы.

qprivs — Запрос привилегий, требуемых для службы.

qtriggerinfo — Запрос параметров службы.

qpreferrednode — Запрос предпочтительного узла NUMA службы.

delete — Удаление службы (из реестра).

create — Создание службы (добавление ее в реестр).

control — Отправка службе управляющего сигнала.

sdshow — Отображение дескриптора безопасности службы.

sdset — Установка дескриптора безопасности службы.

showsid — Отображение строки SID службы, соответствующей произвольному имени.

triggerinfo — Настройка параметров триггеров службы.

preferrednode — Задание предпочтительного узла NUMA службы.

GetDisplayName — Получение параметра DisplayName для службы.

GetKeyName — Получение имени раздела для службы (ServiceKeyName).

EnumDepend — Перечисление зависимостей службы.

Следующие команды не требуют имени службы:

sc сервер команда параметры boot -(ok | bad) Показывает, требуется ли сохранить последнюю загрузку в качестве последней удачной конфигурации загрузки

Lock -Блокировка базы данных служб

QueryLock -Запрос состояния блокировки (LockStatus) базы данных диспетчера управления службами (SCManager)

Справка для команд QUERY и QUERYEX:

Параметры QUERY и QUERYEX:

Если после команды query указано имя службы, будет возвращено cостояние этой службы. В этом случае дополнительные параметры не используются. Если после команды запроса указаны следующие параметры либо ничего не указано, выполняется перечисление служб.

type= — Тип служб для перечисления (driver, service, all) (по умолчанию = service)

state= — Состояние служб для перечисления (inactive, all) (по умолчанию = active)

bufsize= — Размер (в байтах) буфера перечисления (по умолчанию = 4096)

ri= — Номер индекса возобновления для начала перечисления (по умолчанию = 0)

group= — Группа служб для перечисления (по умолчанию = все группы)

Примеры использования SC.

sc query — Перечислить состояния активных служб и драйверов

sc query dnscache — Отобразить состояние службы DNS-клиент, имеющей короткое имя dnscache

Пример отображаемой информации:

Тип
Состояние

Код_выхода_Win32
Код_выхода_службы
Контрольная_точка
Ожидание

: 20 WIN32_SHARE_PROCESS
: 4 RUNNING
(STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
: 0 (0x0)
: 0 (0x0)
: 0x0
: 0x0

sc \\mycomp queryex dnscache — отображение расширенного состояния службы DNS-клиент на компьютере с именем mycomp

Пример отображаемой информации:

Имя_службы: dnscache
Тип
Состояние

Код_выхода_Win32
Код_выхода_службы
Контрольная_точка
Ожидание
ID_процесса
Флаги

: 20 WIN32_SHARE_PROCESS
: 4 RUNNING
(STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
: 0 (0x0)
: 0 (0x0)
: 0x0
: 0x0
: 1312
:

sc stop dnscache — остановить службу DNS-клиент на локальном компьютере

sc start dnscache — запустить службу DNS-клиент на локальном компьютере

sc query type= driver — отобразить информацию всех активных драйверов

sc query type= service — отобразить информацию всех активных служб Windows

sc query state= all — отобразить информацию всех активных драйверов и служб Windows

Обратите внимание на наличие пробела после знака равенства (state= all …) в параметрах перечисленных команд.

sc query type= driver group= NDIS — отобразить информацию обо всех драйверах группы NDIS ( сетевых драйверах )

Пример отображаемой информации:

Имя_службы: BfLwf
Выводимое_имя: Qualcomm Atheros Bandwidth Control

Тип
Состояние &nbsp
Код_выхода_Win32
Код_выхода_службы
Контрольная_точка
Ожидание
: 1 KERNEL_DRIVER
: 4 RUNNING
(STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
: 0 (0x0)
: 0 (0x0)
: 0x0
: 0x0

.
.
.
Имя_службы: wna3100m
Выводимое_имя: NETGEAR WNA3100M N300 Wireless Mini USB Adapter

Тип
Состояние
&nbsp
Код_выхода_Win32
Код_выхода_службы
Контрольная_точка
Ожидание
: 1 KERNEL_DRIVER
: 4 RUNNING
(STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
: 0 (0x0)
: 0 (0x0)
: 0x0
: 0x0


sc query wna3100m — отобразить информацию о драйвере NETGEAR WNA3100M N300 Wireless Mini USB Adapter.

sc query type= interact — отобразить информацию обо всех интерактивных службах.

sc query state= inactive — отобразить информацию обо всех остановленных службах

sc query state= inactive > C:\Stopedsvc.txt — записать информацию обо всех остановленных службах в текстовый файл C:\Stopedsvc.txt . Перенаправление вывода в текстовый файл удобно использовать для сохранения информации и ее последующего использования.

sc qc dnscache — отобразить данные конфигурации для службы DNS-клиент.

Пример выводимой информации:

[SC] QueryServiceConfig: успех

Имя_службы: dnscache

Тип
Тип_запуска
Управление_ошибками
Имя_двоичного_файла
Группа_запуска
Тег
Выводимое_имя
Зависимости
&bnsp
Начальное_имя_службы
: 20 WIN32_SHARE_PROCESS
: 2 AUTO_START
: 1 NORMAL
: C:\Windows\system32\svchost.exe -k NetworkService
: TDI
: 0
: DNS-клиент
: Tdx
: nsi
: NT AUTHORITY\NetworkService

sc showsid dnscache — отобразить уникальный идентификатор SID службы DNS-клиент

Для конфигурирования системных служб используется команда sc config … , выполняющая изменение записи службы в реестре и в базе данных служб.

sc сервер config [имя службы] параметр1 параметр2.

Параметры командной строки:

Имя параметра включает знак равенства (=). Между знаком равенства и значением параметра должен быть пробел.

type= own|share|interact|kernel|filesys|rec|adapt — тип службы
start= boot|system|auto|demand|disabled|delayed-auto — тип запуска службы
error= normal|severe|critical|ignore — режим обработки ошибок
binPath= путь_к_двоичному_файлу — путь и имя исполняемого файла
group= группа_запуска — группа, к которой относится драйвер.
tag= yes|no наличие признака для определения порядка запуска внутри группы
depend= зависимости (разделенные / (косой чертой)) — зависимости службы
obj= имя_учетной_записи|имя_объекта
DisplayName= выводимое имя
password= пароль

Информация о драйверах и системных службах (сервисах) находится в разделе
HKLM\SYSTEM\CurrentControlSet\Services
Каждому драйверу или сервису соответствует свой раздел. Например, «msahci» — для драйвера стандартного SATA контроллера жестких дисков, «DNScache» — для службы «DNS клиент».

Настройка и настройка службы серверов

В этой статье описывается настройка и настройка службы Windows Server.

Исходная версия продукта: Windows Server 2012 R2
Исходный номер КБ: 128167

Аннотация

Хотя служба Windows Server самонастройка, ее также можно настроить вручную с помощью службы панели управления. Обычно параметры конфигурации сервера настраиваются автоматически (вычисляются и устанавливаются) при каждой загрузке Windows. Однако при запуске NET CONFIG SERVER в сочетании с параметром OR текущие значения автоматически настроенных параметров отображаются и регистрируются /AUTODISCONNECT /SERVCOMMENT в /HIDDEN реестре. После записи этих параметров в реестр вы не сможете настроить службу сервера с помощью сетей панели управления.

Если вы добавляете или удаляете системную память или меняете параметры размера сервера свести к минимуму, сбалансировать или увеличить максимальную величину), Windows не будет автоматически настраивать службу сервера для новой конфигурации. Например, при запуске и добавлении памяти на компьютер Windows не увеличивает вычисляемую величину автоматически NET CONFIG SRV /SRVCOMMENT настроенных записей.

При вводе NET CONFIG SERVER в запросе cmd без дополнительных параметров автонастройка остается без изменений, при этом отображаются полезные сведения о конфигурации сервера.

Дополнительные сведения

Служба серверов поддерживает уровни информации, которые могут устанавливать каждый параметр по отдельности. Например, команда NET CONFIG SRV /HIDDEN использует уровень информации 1016, чтобы установить только скрытый параметр. Однако NET.EXE запросов и устанавливает уровни информации 102 (скрытые, комментарии, пользователи и параметры диска) и 502. В результате все параметры на уровне информации окончательно заданы в реестре. SRVMGR.EXE и сервер панели управления и установите только уровень 102 (не уровень 502) при изменении комментария сервера.

Администраторы, желающие скрыть компьютеры с Windows в списке просмотра или изменить значение автоподключения, должны внести эти изменения с помощью REGEDT32.EXE вместо эквивалентов командной строки, рассмотренных выше. Комментарий сервера можно изменить с помощью поля описания applet сервера панели управления или диспетчера серверов.

Решение

В этот раздел, описание метода или задачи включены действия, содержащие указания по изменению параметров реестра. Однако неправильное изменение параметров реестра может привести к возникновению серьезных проблем. Поэтому следует в точности выполнять приведенные инструкции. Для дополнительной защиты создайте резервную копию реестра, прежде чем редактировать его. Так вы сможете восстановить реестр, если возникнет проблема. Для получения дополнительных сведений о том, как создать и восстановить реестр, щелкните следующий номер статьи, чтобы просмотреть статью в базе знаний Майкрософт:
322756 Создание резервной копии и восстановление реестра Windows

Чтобы восстановить параметры lan Manager Server до параметров по умолчанию или перенастроить Windows таким образом, чтобы она автоматически настраивала службу сервера:

Запустите редактор реестра (REGEDT32.EXE).

Из под HKEY_LOCAL_MACHINE подtree перейдите к следующему ключу:
\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters

Удалите все записи, кроме следующих:
EnableSharedNetDrives
Lтовунс
NullSessionPipes
NullSessionShares
Size

Здесь могут быть другие записи, статически закодифицированные. Не удалять эти записи.

Запустите редактор реестра и перезапустите Windows.

Configuring Services Using Configuration Files

Configuring a Windows Communication Foundation (WCF) service with a configuration file gives you the flexibility of providing endpoint and service behavior data at the point of deployment instead of at design time. This topic outlines the primary techniques available.

A WCF service is configurable using the .NET Framework configuration technology. Most commonly, XML elements are added to the Web.config file for an Internet Information Services (IIS) site that hosts a WCF service. The elements allow you to change details such as the endpoint addresses (the actual addresses used to communicate with the service) on a machine-by-machine basis. In addition, WCF includes several system-provided elements that allow you to quickly select the most basic features for a service. Starting with .NET Framework 4, WCF comes with a new default configuration model that simplifies WCF configuration requirements. If you do not provide any WCF configuration for a particular service, the runtime automatically configures your service with some standard endpoints and default binding/behavior. In practice, writing configuration is a major part of programming WCF applications.

For more information, see Configuring Bindings for Services. For a list of the most commonly used elements, see System-Provided Bindings. For more information about default endpoints, bindings, and behaviors, see Simplified Configuration and Simplified Configuration for WCF Services.

When deploying side by side scenarios where two different versions of a service are deployed, it is necessary to specify partial names of assemblies referenced in configuration files. This is because the configuration file is shared across all versions of a service and they could be running under different versions of the .NET Framework.

System.Configuration: Web.config and App.config

WCF uses the System.Configuration configuration system of the .NET Framework.

When configuring a service in Visual Studio, use either a Web.config file or an App.config file to specify the settings. The choice of the configuration file name is determined by the hosting environment you choose for the service. If you are using IIS to host your service, use a Web.config file. If you are using any other hosting environment, use an App.config file.

In Visual Studio, the file named App.config is used to create the final configuration file. The final name actually used for the configuration depends on the assembly name. For example, an assembly named «Cohowinery.exe» has a final configuration file name of «Cohowinery.exe.config». However, you only need to modify the App.config file. Changes made to that file are automatically made to the final application configuration file at compile time.

In using an App.config, file the configuration system merges the App.config file with content of the Machine.config file when the application starts and the configuration is applied. This mechanism allows machine-wide settings to be defined in the Machine.config file. The App.config file can be used to override the settings of the Machine.config file; you can also lock in the settings in Machine.config file so that they get used. In the Web.config case, the configuration system merges the Web.config files in all directories leading up to the application directory into the configuration that gets applied. For more information about configuration and the setting priorities, see topics in the System.Configuration namespace.

Major Sections of the Configuration File

The main sections in the configuration file include the following elements.

The bindings and behaviors sections are optional and are only included if required.

The Element

The services element contains the specifications for all services the application hosts. Starting with the simplified configuration model in .NET Framework 4, this section is optional.

The Element

Each service has these attributes:

name . Specifies the type that provides an implementation of a service contract. This is a fully qualified name which consists of the namespace, a period, and then the type name. For example «MyNameSpace.myServiceType» .

behaviorConfiguration . Specifies the name of one of the behavior elements found in the behaviors element. The specified behavior governs actions such as whether the service allows impersonation. If its value is the empty name or no behaviorConfiguration is provided then the default set of service behaviors is added to the service.

The Element

Each endpoint requires an address, a binding, and a contract, which are represented by the following attributes:

address . Specifies the service’s Uniform Resource Identifier (URI), which can be an absolute address or one that is given relative to the base address of the service. If set to an empty string, it indicates that the endpoint is available at the base address that is specified when creating the ServiceHost for the service.

binding . Typically specifies a system-provided binding like WSHttpBinding, but can also specify a user-defined binding. The binding specified determines the type of transport, security and encoding used, and whether reliable sessions, transactions, or streaming is supported or enabled.

bindingConfiguration . If the default values of a binding must be modified, this can be done by configuring the appropriate binding element in the bindings element. This attribute should be given the same value as the name attribute of the binding element that is used to change the defaults. If no name is given, or no bindingConfiguration is specified in the binding, then the default binding of the binding type is used in the endpoint.

contract . Specifies the interface that defines the contract. This is the interface implemented in the common language runtime (CLR) type specified by the name attribute of the service element.

The Element

The bindings element contains the specifications for all bindings that can be used by any endpoint defined in any service.

The Element

The binding elements contained in the bindings element can be either one of the system-provided bindings (see System-Provided Bindings) or a custom binding (see Custom Bindings). The binding element has a name attribute that correlates the binding with the endpoint specified in the bindingConfiguration attribute of the endpoint element. If no name is specified then that binding corresponds to the default of that binding type.

For more information about configuring services and clients, see Configuring WCF services.

The Element

This is a container element for the behavior elements that define the behaviors for a service.

The Element

Each behavior element is identified by a name attribute and provides either a system-provided behavior, such as throttling >, or a custom behavior. If no name is given then that behavior element corresponds to the default service or endpoint behavior.

How to Use Binding and Behavior Configurations

WCF makes it easy to share configurations between endpoints using a reference system in configuration. Rather than directly assigning configuration values to an endpoint, binding-related configuration values are grouped in bindingConfiguration elements in the section. A binding configuration is a named group of settings on a binding. Endpoints can then reference the bindingConfiguration by name.

The name of the bindingConfiguration is set in the element. The name must be a unique string within the scope of the binding type—in this case the , or an empty value to refer to the default binding. The endpoint links to the configuration by setting the bindingConfiguration attribute to this string.

A behaviorConfiguration is implemented the same way, as illustrated in the following sample.

Note that the default set of service behaviors are added to the service. This system allows endpoints to share common configurations without redefining the settings. If machine-wide scope is required, create the binding or behavior configuration in Machine.config. The configuration settings are available in all App.config files. The Configuration Editor Tool (SvcConfigEditor.exe) makes it easy to create configurations.

Behavior Merge

The behavior merge feature makes it easier to manage behaviors when you want a set of common behaviors to be used consistently. This feature allows you to specify behaviors at different levels of the configuration hierarchy and have services inherit behaviors from multiple levels of the configuration hierarchy. To illustrate how this works assume you have the following virtual directory layout in IIS:

\Web.config file has the following contents:

And you have a child Web.config located at

\Child\Web.config with the following contents:

The service located at

\Child\Service.svc will behave as though it has both the serviceDebug and serviceMetadata behaviors. The service located at

\Service.svc will only have the serviceDebug behavior. What happens is that the two behavior collections with the same name (in this case the empty string) are merged.

You can also clear behavior collections by using the tag and removed individual behaviors from the collection by using the tag. For example, the following two configuration results in the child service having only the serviceMetadata behavior:

Behavior merge is done for nameless behavior collections as shown above and named behavior collections as well.

Behavior merge works in the IIS hosting environment, in which Web.config files merge hierarchically with the root Web.config file and machine.config. But it also works in the application environment, where machine.config can merge with the App.config file.

Behavior merge applies to both endpoint behaviors and service behaviors in configuration.

If a child behavior collection contains a behavior that’s already present in the parent behavior collection, the child behavior overrides the parent. So if a parent behavior collection had and a child behavior collection had , the child behavior would override the parent behavior in the behavior collection and httpGetEnabled would be «true».

Читайте также:  Пакет установить linux header
Оцените статью