How do I stop remote access

Restart Windows service remotely with sc.exe or Powershell

If you have to restart an application that runs as a Windows service, this is relatively uncomplicated via the corresponding GUI application in the start menu Administration => Services (or via services.msc in direct call). This also works remotely if you go through the menu action connects to another computer. However, if you want to carry out this process on several computers or initiate it in a script, the command line tool can help sc.exe or Powershell.

While under older Windows versions still net start [service] and net stop [service] the common tools for starting and stopping a service are now available with sc.exe a more powerful tool available. It offers numerous options for controlling Windows services, including those for listing, starting, resuming, and stopping. With

you can display the names of all active services on the local computer, which you can then use the switches begin, Break, continue and stop can control. There is no command to restart, for this purpose you have to stop and begin combine. If you want to execute these commands on a remote computer, enter its name as the first parameter in UNC syntax:

Restart-service cmdlet in Powershell

In contrast to sc.exe Powershell has the ability to restart a Windows service with a single command, namely the cmdlet restart-service. If you know the name of the service, the call is for the local machine

The cmdlet produces an error message when trying to restart a service on which other services depend. You can either force a restart with the -force parameter or with

see which services depend on said service and whether you really want to have the restart at any cost.

Restart the service remotely with Powershell

To remotely restart a Windows service, you have to use the invoke-command walk:

If necessary, the -computer argument can be passed a list of hostnames separated by commas.

A prerequisite for all forms of remote control of services is of course that the current user has sufficient rights and that WinRM is activated on the remote computer.