Tip: New Command-Line Switches for Sc.exe

You can use the sc.exe command to start, stop, configure, and manage various aspects of services in the same way that you can on earlier versions of Windows. On Windows Vista, however, the sc.exe command has been enhanced with new command-line switches.

New switches for specifying required privileges for a service include:

-privs Sets the required privileges for a service.

-qprivs Queries for the required privileges of a service.

New switches that support per-service SIDs include:

-sidtype Changes a service’s SID.

-qsidtype Retrieves the setting for service’s SID.

New switches to enable configuration of the FailureActionsOnNonCrashFailures setting include:

-failureflag Changes the setting of the FailureActionsOnNonCrashFailures flag.

-qfailureflag Retrieves the setting for the FailureActionsOnNonCrashFailures flag.

-showsid Displays the service SID string corresponding to an arbitrary name.

-stop This is an old setting that has been enhanced in Windows Vista to specify the stop reason. This enables postmortem reliability analysis to find out reasons (by examining the event logged by the SCM with the stop reason) an administrator would stop a service.

For more information about these new command-line switches for sc.exe, type sc /? at a command prompt.

From the Microsoft Press book Windows Vista Resource Kit, Second Edition.

Looking for More Tips?

For more Windows Vista tips, visit the TechNet Magazine Windows Vista Tips page.

For more Tips on other products, visit the TechNet Magazine Tips index.