How to restart Remote Desktop service remotely

Get answers from your peers        along with millions of IT pros who visit Spiceworks.     Join Now

So I have two servers that for some reason stopped allowing rdp connections this morning.

I have googled the interweb with little success. most say it cannot be done and those that do say it can be it just doesnt work for me.

I found the following instructions using tasklist and taskkill:

1-tasklist /s \\servername /svc /fi "imagename eq svchost.exe"(locate PID for TermService)

2- taskkill /s \\servername /pid xxxx (may need /f to force, UAC might give problems as well)

3- sc \\servername start TermService

When I run taskkill on step2 I get the following:

ERROR: The process with PID 4392 could not be terminated.
Reason: An internal error occurred.

Well isn't that just great. I am using a domain admnistrator account and running cmd as administrator.

I would like to not have to restart the servers.

thanks!


Popular Topics in Windows Server

  • Are you smarter than most IT pros? Take the Daily Challenge »
  • Hacked 2016 Server
  • Upgrade 2012 r2 to 2019 - Can't keep files
  • windows update keeps failing to install (KB4535680) - Error 0x800f0922         TEST YOUR SMARTS        Which of the following retains the information it's storing when the system power is turned off?
  • ROM
  • CPU
  • RAM
  • GPU             Submit »              88% of IT pros got this right.    Challenge

×

10 Replies                · · ·

TimBSG

Serrano OP                    TimBSG         Aug 5, 2014 at 20:40 UTC

Have you tried running the services.msc and then connecting to the server (Action -> Connect to another computer) and restarting the service through the GUI?   0          · · ·

Little Green Man

Pure Capsaicin OP                    Little Green Man

This person is a Verified Professional

This person is a verified professional.                   Verify your account to enable IT peers to see that you are a professional.                Aug 5, 2014 at 20:48 UTC

Very possible. Do you have PowerShell?

http://blogs.technet.com/b/heyscriptingguy/archive/2013/10/13/powertip-use-poweshell-to-start-servic...

If you have WinRM enabled, and have PowerShell, it's really really easy.   0          · · ·

shdw1jz

Serrano OP                    shdw1jz         Aug 5, 2014 at 20:55 UTC

have you tried using the free logmein, install it on the server so that you can access it remotely, in case the services stopped working.   0          · · ·

ceez

Thai Pepper OP                    ceez         Aug 5, 2014 at 20:56 UTC

@timbsg, I tried that, it stopped it but failed to start it and now it's stuck in 'starting'.

@bill kindle - I am not powershell literate, but I'll check out that link.

why cant ms make things like these much easier?!?1

ps - no go on the powershell :(   0          · · ·

Kelly Armitage

Ghost Chili OP                    Kelly Armitage         Aug 5, 2014 at 20:56 UTC

I use this method to enable remote desktop, remotely..... fairly often... I can see it may be of use to turn it off and then back on (although it wouldn't be restarting the service).

http://oreilly.com/windows/archive/server-hacks-remote-desktop.html
  1          · · ·

ceez

Thai Pepper OP                    ceez         Aug 5, 2014 at 21:06 UTC

Kelly Armitage wrote:
I use this method to enable remote desktop, remotely..... fairly often... I can see it may be of use to turn it off and then back on (although it wouldn't be restarting the service).
http://oreilly.com/windows/archive/server-hacks-remote-desktop.html

kelly that registry change requires a server reboot. It wouldnt help me in this situation. thanks anyways, good to have.   0          · · ·

Kelly Armitage

Ghost Chili OP                    Kelly Armitage         Aug 5, 2014 at 21:08 UTC

Okay.... on a Win 7 client there is no reboot required.

*EDIT* In fact, the link I shared is using 2003 as the use case...... and a reboot may have been required. Since Win 7 and 2008R2 are largely the same, I'd be willing to bet a coffee, that Server 2008R2 would not need to be rebooted for it to take affect.   0          · · ·

Mooney

Cayenne OP                    Mooney         Aug 5, 2014 at 21:24 UTC

If you can't connect with services.msc then I think you have a larger problem.

Another option though is to download PSTools (on any machine with powershell), extract it to the C:\ drive and then run this command in powershell:

Text c:\pstools\psexec.exe\\Ceez-TS01 CMD

This will start a command prompt which is running on Ceez-TS01, allowing you to just-

net stop termservice
net start termservice
  3          · · ·

Evan5180

Anaheim OP                    Evan5180         Aug 5, 2014 at 21:56 UTC

I didn't notice any mention of Netsvc. So far, Tim, Mooney and Bill have both offered usable solutions in environments where WinRM is enabled. Those are really the preferred tools anymore, but Netsvc should still get the job done for you.

netsvc.exe "servicename" \\computername /stop

netsvc.exe "servicename" \\computername /start   1          · · ·

ceez

Thai Pepper OP                    ceez         Aug 7, 2014 at 03:28 UTC

so i ended up having to restart the servers after hours. for some reason these got stuck i think during a veeam backup of the hyper-v vm's and snapshotting on the powervault. I had to hard shutdown....i hate having to do that. everything came back up and now working.

I am interested though in the future in getting somethink like rd services restarted. thank you all for your advice.   0

This topic has been locked by an administrator and is no longer open for commenting.

To continue this discussion, please ask a new question.

Video liên quan