Home > Back-end >  How to realize the control of external programs on the system service
How to realize the control of external programs on the system service

Time:04-02

Windows common c + + program (the program must not have administrator privileges) to realize to control their registration system service?

CodePudding user response:

C: \ & gt; sc/?

Error: unknown command

Description:
SC is used to communicate with service control manager and service
Command line programs,
Usage:
Sc & lt; Server> [command] [service name]

& lt; Server> The format of the option to "\ \ ServerName"
By typing the following command to get more help about command: "sc (command)
"Command:
Query -- -- -- -- -- -- -- -- -- -- - the state of the query service,
Or the state of enumeration service type,
Queryex -- -- -- -- -- -- -- -- -- the expansion of the query service,
Or the state of enumeration service type,
Start -- -- -- -- -- -- -- -- -- -- - start the service,
Pause -- -- -- -- -- -- -- -- -- -- - send pause control to the service request,
Interrogate -- -- -- -- -- to interrogate the control of the service request,
The continue -- -- -- -- -- -- -- -- to continue the control of the service request,
Stop -- -- -- -- -- -- -- -- -- -- -- -- to the stop of the service request,
Config -- -- -- -- -- -- -- -- -- -- change the service configuration (permanent),
Description -- -- -- -- -- change the service description,
Failure -- -- -- -- -- -- -- -- -- change the failed service execution,
Failureflag -- -- -- -- -- change the service failure of the operation symbol,
Sidtype -- -- -- -- -- -- -- -- -- change the service type of service SID,
Privs -- -- -- -- -- -- -- -- -- -- - change the service required privilege,
Managedaccount - change the service to the service account password
Marked by LSA management,
Qc -- -- -- -- -- -- -- -- -- -- -- -- -- -- the query service configuration information,
Qdescription - query service description,
Qfailure -- -- -- -- -- -- -- -- query failed service execution operation,
Qfailureflag - the failure of the query service operation signs,
Qsidtype -- -- -- -- -- -- -- -- the types of service SID query service
Qprivs -- -- -- -- -- -- -- -- -- -- query service required privilege,
Qtriggerinfo - trigger parameters of the query service,
Qpreferrednode - query service preferred NUMA node,
Qmanagedaccount - will query service account
Combined with LSA management password,
Qprotection -- -- -- -- -- the process of query service level of protection,
Quserservice - queries the user service template local instance,
Delete -- -- -- -- -- -- -- -- -- -- () from the registry delete services,
Create -- -- -- -- -- -- -- -- -- -- to create the service (and added to the registry),
Control -- -- -- -- -- -- -- -- -- send service control,
Sdshow -- -- -- -- -- -- -- -- -- -- show service security descriptor,
Sdset -- -- -- -- -- -- -- -- -- -- - set up the service security descriptor,
Showsid -- -- -- -- -- -- -- -- -- according to the corresponding service as the name of any SID string,
Triggerinfo - trigger parameters configuration services,
Preferrednode - set up the service of choice for NUMA node,
DisplayName GetDisplayName - access to services,
GetKeyName -- -- -- -- -- - service ServiceKeyName,
EnumDepend -- -- -- -- -- - the enumeration service dependencies,

The following command does not need the service name:
Sc & lt; Server> & lt; Command> & lt; Option>
The boot -- -- -- -- -- -- -- -- -- -- -- -- (ok | bad) indicates whether or not it should be the last time start save as
The latest known correctly launch configuration
The Lock -- -- -- -- -- -- -- -- -- -- -- --
Lock service databaseQueryLock -- -- -- -- -- -- -- database query SCManager LockStatus
Example:
Sc start MyService


The QUERY and QUERYEX options:
If the query command with the service name, returns the
The service state, the other option is not suitable for this kind of
Situation, if the query command with no arguments or
This service with one of the following options to enumeration,
Type=to enumerate the types of services (driver, service, userservice, all)
(default=service)
State=to enumerate the state of the service (inactive, all)
(default=active)
Bufsize=enumerated the buffer size (in bytes)
(default=4096)
Ri=started enumeration recovery index number
(default=0)
Group=to enumerate the service
(default=all groups)

Grammar example
Sc query - enumeration activity service and driver
Sc query eventlog - show the state of the eventlog service
Sc queryex eventlog - display eventlog service extension state
Sc query type=driver - just enumerated driver
Sc query type=service - only enumeration Win32 service
Sc query state=all - enumerates all service and driver
Sc query bufsize=50 - enumeration buffer for 50 bytes
Sc query ri=14 - enumeration recovery index=14
Sc queryex group="" - an enumeration is not within the group activity service
Sc query type=interact - enumerate all inactive service
Sc query type=driver group=NDIS - enumerated all the NDIS driver


CodePudding user response:

reference 1/f, zhao teacher reply:
c: \ & gt; sc/?

Error: unknown command

Description:
SC is used to communicate with service control manager and service
Command line programs,
Usage:
Sc & lt; Server> [command] [service name]

& lt; Server> The format of the option to "\ \ ServerName"
By typing the following command to get more help about command: "sc (command)
"Command:
Query -- -- -- -- -- -- -- -- -- -- - the state of the query service,
Or the state of enumeration service type,
Queryex -- -- -- -- -- -- -- -- -- the expansion of the query service,
Or the state of enumeration service type,
Start -- -- -- -- -- -- -- -- -- -- - start the service,
Pause -- -- -- -- -- -- -- -- -- -- - send pause control to the service request,
Interrogate -- -- -- -- -- to interrogate the control of the service request,
The continue -- -- -- -- -- -- -- -- to continue the control of the service request,
Stop -- -- -- -- -- -- -- -- -- -- -- -- to the stop of the service request,
Config -- -- -- -- -- -- -- -- -- -- change the service configuration (permanent),
Description -- -- -- -- -- change the service description,
Failure -- -- -- -- -- -- -- -- -- change the failed service execution,
Failureflag -- -- -- -- -- change the service failure of the operation symbol,
Sidtype -- -- -- -- -- -- -- -- -- change the service type of service SID,
Privs -- -- -- -- -- -- -- -- -- -- - change the service required privilege,
Managedaccount - change the service to the service account password
Marked by LSA management,
Qc -- -- -- -- -- -- -- -- -- -- -- -- -- -- the query service configuration information,
Qdescription - query service description,
Qfailure -- -- -- -- -- -- -- -- query failed service execution operation,
Qfailureflag - the failure of the query service operation signs,
Qsidtype -- -- -- -- -- -- -- -- the types of service SID query service
Qprivs -- -- -- -- -- -- -- -- -- -- query service required privilege,
Qtriggerinfo - trigger parameters of the query service,
Qpreferrednode - query service preferred NUMA node,
Qmanagedaccount - will query service account
Combined with LSA management password,
Qprotection -- -- -- -- -- the process of query service level of protection,
Quserservice - queries the user service template local instance,
Delete -- -- -- -- -- -- -- -- -- -- () from the registry delete services,
Create -- -- -- -- -- -- -- -- -- -- to create the service (and added to the registry),
Control -- -- -- -- -- -- -- -- -- send service control,
Sdshow -- -- -- -- -- -- -- -- -- -- show service security descriptor,
Sdset -- -- -- -- -- -- -- -- -- -- - set up the service security descriptor,
Showsid -- -- -- -- -- -- -- -- -- according to the corresponding service as the name of any SID string,
Triggerinfo - trigger parameters configuration services,
Preferrednode - set up the service of choice for NUMA node,
DisplayName GetDisplayName - access to services,
GetKeyName -- -- -- -- -- - service ServiceKeyName,
EnumDepend -- -- -- -- -- - the enumeration service dependencies,

The following command does not need the service name:
Sc & lt; Server> & lt; Command> & lt; Option>
The boot -- -- -- -- -- -- -- -- -- -- -- -- (ok | bad) indicates whether or not it should be the last time start save as
The latest known correctly launch configuration
The Lock -- -- -- -- -- -- -- -- -- -- -- --
Lock service databaseQueryLock -- -- -- -- -- -- -- database query SCManager LockStatus
Example:
Sc start MyService


The QUERY and QUERYEX options:
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related