≡ Menu

Start / Stop / Enable / Disable Terminal services from command line

We can start Terminal Services by running the command given below.

net start TermService

If the service is already running you will get the message ‘The requested service has already been started.
Sometimes you may get an error that the service could not be started.

C:\>net start termservice
The Terminal Services service is starting.
The Terminal Services service could not be started.
The service did not report an error.
More help is available by typing NET HELPMSG 3534.

This happens when Terminal Services is disabled through registry hack. You can fix this by running the below registry change command.

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v TSEnabled /t REG_DWORD /d 1 /f

You need to reboot the computer for the changes to take effect. After reboot terminal services starts automatically or you can start the service using net start command as mentioned above.

How to stop Terminal Services?

Terminal Services can’t be stopped like other services.  You get the below error when you attempt the same.

C:\>net stop termservice
The requested pause or stop is not valid for this service.

How to restart Terminal services?

Since Terminal Services can’t be stopped there is no straightforward way we can do this. Microsoft says this is by design. But in some cases restarting terminal services could be possible by killing the svchost process that runs the terminal services.We can use tasklist and taskkill commands for this.

First get the process id of the terminal services process

 tasklist /svc | findstr /C:TermService

Check if Terminal services is the only service running in this svchost. If the svchost is shared with other services then you can stop reading further. Restarting terminal services is not possible on your machine.

On my system I have got the following output.

C:\>tasklist /svc | findstr /C:TermService
svchost.exe                 1708 DcomLaunch, TermService
C:\>
As you can see DcomLaunch and TermServiceboth share the same svchost process. In this case I can't kill the process as it stops the other service also. (Note that DcomLaunch is an essential service on the system and killing it can even shutdown the system)
In the case of svchost not being shared with any other service you can go ahead and kill TermService process by the following command.
taskkill /F /PID  process_id

How to disable Terminal Services?

We can run the below command to disable terminal services.

sc config TermService start= disabled

How to enable Terminal Services?

sc config TermService start= auto

(or)

sc config TermService start= demand
18 comments… add one
  • Anonymous

    For your taskkill, command, the switch should be "/PID" not "/PIN"; also, I got an error message saying it can only be terminated forcefully using the /F swtich

  • Anonymous

    Yes, regarding the taskkill command the right syntax is: taskkill /F /PID process_id

  • Anonymous

    Thanks! I appreciate you posting this helpful article

  • Wes

    Great post … helped me out in a pinch…

  • EL

    I have an error in Taskkill .

    ERROR: The process “process_id” not found.
    what is it?

  • Tom

    :noogies to head: You need to replace “process_id” with the actual PID. You can find this on the “Services” tab of the Task Manager for the service you are looking for. In this case, you would look for TermService (select the “Name” column title to alphabetize, so it’s easier to find), which for me the PID was 1056, but could (and probably will) vary.

  • people2004

    why dont’ you use services.msc to disable Terminal Services?

    • Fox

      You can’t, the server won’t allow it.

      Hence this procedure.

  • romrun

    i can’t run sc config not work
    example sc config vnc start= auto
    error message sc openservice failed 1060:
    how to use

    • some user

      @romrun run command prompt as administrator think that might fix issue

  • Shashank

    It stops fine on Windows 7. I think the error is only for XP or pre-Win7.

  • Javier

    HI!, Thanks. It works perfect, … but..
    I want do a bat file to switch on/off RDP. When stop service, there´s another service that stop, and Windows ask if I´m agree. Do you now haw I can force?

    • some user

      @Javier make your batch file somehow mimic typing, because usually when windows asks for confirmation, it is a type y or n question. So, just make your batch file somehow type “y”. You can easily find a tutorial on how to do this in python or almost any scripting /programming language.

  • Julie Dalanon

    I got “System error 5 has occured. Access is denied.” when I enter the command net start termservice. What should I do?

    • Steve

      Make sure you are running Command Prompt as administrator…

  • some user

    actually error 1060 is service not found, so you need to find the service name not the display service name in services.msc, this can be found by right clicking service >> properties >> under service name is the service name.

  • John Doe

    You can change /pid by /im and replace the processo id number per termservice.exe

  • robby

    This is a really weird solution. I’ve been working with terminal services since Windows NT and the last 20 years I haven’t come across a single case where restarting the services fixes anything. If people want to manage login on the service they should probably use CHANGE LOGON to prevent people login on.

Cancel reply

Leave a Comment