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

转载 2012年03月29日 11:51:03


http://www.windows-commandline.com/2010/10/start-terminal-services-command-line.html


How to start Terminal Services from command line?

We can start Terminal Services from command line 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.

Thishappens when Terminal Services is disabled through registry hack. Youcan 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

Youneed to reboot the computer for the changes to take effect. Afterreboot terminal services starts automatically or you can start theservice using net start command as mentioned above.

How to stop Terminal Services from command line?

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 from command line?

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 termninal services could be possible bykilling the svchost process that runs the terminal services.We can usetasklist and taskkill commands for this.

First get the process id of the terminal services process

 tasklist /svc | findstr /C:TermService

Checkif Terminal sevices is the only service running in this svchost. If thesvchost is shared with other services then you can stop readingfurther. Restarting terminal services is not possible on your machine.

On my machine 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 theprocess as it stops the other service also. (Note that DcomLaunch is anessential service on the system and killing it can even shutdown thesystem)


In the case of svchost not being sharedwith any other service you can go ahead and kill TermService process bythe following command.


taskkill /F /PID  process_id  


How to disable Terminal Services from command line?

We can run the below command to disable terminal services.

sc config TermService start= disabled

How to enable Terminal Services from command line?

sc config TermService start= auto

(or)

sc config TermService start= demand


Enable/disable a device from the command line

Enable/disable a device from the command line Install DevconDisplay all the devices in the sy...
  • liukeforever
  • liukeforever
  • 2011年08月24日 08:24
  • 811

How enable/disable windows feature from command line

This post talksabout the command line options for enabling/disabling features in Windows 7 OS. Feat...
  • mrliming
  • mrliming
  • 2012年02月07日 16:58
  • 1013

Stop Delete OR Disable Services

Set objWMIService = GetObject("//" & strComputer & "/root/cimv2")Set colServiceList = objWMIService....
  • leyvan
  • leyvan
  • 2009年02月14日 15:26
  • 336

enable or disable system services

NAME        chkconfig - enable or disable system services SYNOPSIS        chkconfig -t|--terse [n...
  • jackie_gnu
  • jackie_gnu
  • 2011年11月28日 15:04
  • 278

在Ubuntu虚拟机中安装VMware tools异常中断 Unable to start services for VMware Tools

前言:我用的是VMware 10.0.3和Ubuntu 14.04.1 LTS,host是Windows 7系统。 在VMware中装完Ubuntu后,为了与host之间互传文件,需...
  • andy205214
  • andy205214
  • 2015年01月25日 12:28
  • 10476

mac homebrew启动服务

you can install the soft with brew install softname eg:brew install mysql or search soft with ...
  • strangerLove
  • strangerLove
  • 2015年12月04日 10:29
  • 2080

How to use VirtualBox in Terminal / Command line

http://www.howopensource.com/2011/06/how-to-use-virtualbox-in-terminal-commandline/ Updated by ...
  • ztguang
  • ztguang
  • 2016年06月17日 17:25
  • 514

DSO missing from command line原因及解决办法

DSO missing from command line原因及解决办法 renweihub 120 1月5日 发布 推荐 1 推荐 收藏 3 收藏,5.2k 浏览 最近项目...
  • shangzh
  • shangzh
  • 2015年10月12日 20:53
  • 2337

Terminal Services中的细节操作

作者:Wei Xie 在Terminal Services中有许多不为人知的细节操作。今天我把这些细节操作统一在一起写出来希望能给大家一些思路。在Terminal Services会话中,我们依然可以...
  • chwhnster
  • chwhnster
  • 2005年12月04日 22:04
  • 997

terminal services服务故障解决过程

有人拿来一台服务器,让我帮他装些服务,做WEB服务器。这台服务器买来就有windows 2000 server。我想服务器将来要放到机房里去,必须启用terminal services服务,否则以后很...
  • china2wto
  • china2wto
  • 2005年06月16日 14:09
  • 3112
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Start / Stop / Enable / Disable Terminal services from command line
举报原因:
原因补充:

(最多只允许输入30个字)