Managing Services and Hardware in Server Core

As people start using Server Core, I have been finding that over time their questions tend to shift from how to perform a task remotely in the GUI to how perform the task from the command line. The impression I get is that there are two underlying reasons for this, 1 – they are getting more comfortable with the command line, and 2 – they want to create scripts for some of their more common tasks to make it easier to manage from the command line. Of course, I could be complete wrong here, so I’d be happy to hear any comments from those using the local or TS command line more.

 

Now that my random thought for the week is out of the way, I’ll talk about how to actually do something.

 

SC.exe is a very powerful command line tool that has been around for awhile but doesn’t seem to be widely known about. When managing services from the command line, net start and net stop are widely used, however SC provides a lot more functionality. SC is in fact a command line equivalent plus more functionality then the Services MMC. Some of the terminology is a little different between the two, for example in the Services MMC you pause and resume services while with SC you pause and continue services.

 

To perform the equivalent the Properties dialog box in the Services MMC, take a look at the options available with “SC config”. You can use SC sdhow and sdset to view and set the permissions for a service.

 

SC can also be used to find out what hardware you have drivers installed for on your Server Core box by running:

            Sc query type= driver

You can then look through the list and find your network card drivers, video drivers, etc. For example on my Server Core box I have the following for network and video:

 

SERVICE_NAME: E1G60

DISPLAY_NAME: Intel(R) PRO/1000 NDIS 6 Adapter Driver

        TYPE               : 1  KERNEL_DRIVER 

        STATE              : 4  RUNNING

                                (STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)

        WIN32_EXIT_CODE    : 0  (0x0)

        SERVICE_EXIT_CODE  : 0  (0x0)

        CHECKPOINT         : 0x0

        WAIT_HINT          : 0x0

 

SERVICE_NAME: vga

DISPLAY_NAME: vga

        TYPE               : 1  KERNEL_DRIVER

        STATE              : 4  RUNNING

                                (STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)

        WIN32_EXIT_CODE    : 0  (0x0)

        SERVICE_EXIT_CODE  : 0  (0x0)

        CHECKPOINT         : 0x0

        WAIT_HINT          : 0x0

 

If I then want to know what the driver file is for my nic so I can check the version, I can run:

D:\Windows\System32\drivers>sc qc e1g60

[SC] QueryServiceConfig SUCCESS

 

SERVICE_NAME: e1g60

        TYPE               : 1  KERNEL_DRIVER

        START_TYPE         : 3   DEMAND_START

        ERROR_CONTROL      : 1   NORMAL

        BINARY_PATH_NAME   : system32\DRIVERS\E1G60I32.sys

        LOAD_ORDER_GROUP   : NDIS

        TAG                : 13

        DISPLAY_NAME       : Intel(R) PRO/1000 NDIS 6 Adapter Driver

        DEPENDENCIES       :

        SERVICE_START_NAME :

 

SC treats drivers like services, so if I have multiple NICs and am troubleshooting a network issue and want to disable a NIC, I can use SC to do that. Using the NIC in my box as an example, I can run: sc stop e1g60. Or, I could use SC to set the startup type to disabled and restart the box.

 

Andrew

Comments

  • Anonymous
    June 22, 2006
    My question is how to get new device drivers installed.  I tried the listed "driverquery" found under help, but that command did not work.  I tried to find some documents on installing new services or devices but so far had no luck.  Have any suggestions?
  • Anonymous
    June 22, 2006
    The comment has been removed
  • Anonymous
    October 08, 2013
    How do you check for missing drivers?  Do you have to use powershell or is there a way to do it with the sc command? I need a way to check to see if my 2012 core server's drivers are all installed or not