Sometimes it is necessary to restart a system service. In this case you can use the standard windows management tools to find and restart the service. This isn’t very complicated but a lot of mouse clicks are necessary. If you have to restart the service very often, for example daily or several times per day, then you look for an easier and fast way to do this task.
The PowerShell offers a very easy way to restart a service. Only the cmdlet Restart-Service is needed. As parameter you have to pass the name of the service. The following code shows the full command to start the PowerShell editor and execute the cmdlet.
PowerShell -NoExit -Command „& {Restart-Service MyService}“
The editor will stay open after the service is restarted. If you remove the NoExit parameter, the editor is closed automatically.