Control Windows services (IIS, OpenSSH, updates) on your Windows VPS. A service is a program that Windows runs in the background, with no one logged in, and many things you install on a server (a web server, an SSH daemon, a database) are services. You can manage them with the Services console (services.msc) or with PowerShell. PowerShell is faster, can be scripted and works just as well in a remote session, so this guide uses it.
📋 Prerequisites
- Administrator RDP or PowerShell session
- Service name (e.g.
W3SVC,sshd) - A PowerShell window opened as Administrator (right-click, then Run as administrator), otherwise most changes are refused
Note that a service exists only if the matching software is installed: W3SVC is the IIS web service and sshd is the OpenSSH server.
List services
PowerShellGet-Service | Sort-Object Status, Name | Format-Table -AutoSize
The Status column shows Running or Stopped, and the list is sorted so that stopped services come first. To see only what is currently running, filter on the status:
PowerShellGet-Service | Where-Object { $_.Status -eq 'Running' }
The short name (Name) is what the commands below expect, and it often differs from the name displayed in the Services console. If you only know the display name, search for it with a wildcard:
PowerShellGet-Service -DisplayName "*OpenSSH*"
Control a service
PowerShellStop-Service -Name W3SVC -Force Start-Service -Name W3SVC Restart-Service -Name W3SVC
Stop-Service stops the service, Start-Service starts it and Restart-Service does both in one step. The -Force flag also stops the services that depend on this one; without it, PowerShell refuses to stop a service that others need. Use it carefully, because stopping a service can take websites or connections offline. Always check the result afterwards, and look at the dependencies if something does not behave as expected:
PowerShellGet-Service -Name W3SVC | Format-List Name, DisplayName, Status, StartType Get-Service -Name W3SVC -DependentServices
Avoid stopping the Remote Desktop service (TermService) while you are connected through RDP: you would cut your own session and could not reconnect without other access.
Set automatic startup
PowerShellSet-Service -Name sshd -StartupType Automatic Get-Service sshd
The startup type decides what happens at boot. Automatic starts the service with Windows, Manual leaves it stopped until something requests it, and Disabled prevents it from starting at all. Setting a service to Automatic does not start it right now; run Start-Service as well, or restart the server. Setting a service to Disabled is a simple way to reduce what is exposed on the machine, as long as you are sure nothing relies on it. The second command confirms the new state.
Our Windows VPS are available in the same 8 locations: Windows VPS France, Windows VPS Germany, Windows VPS Netherlands, Windows VPS United Kingdom, Windows VPS USA, Windows VPS Canada, Windows VPS Turkey and Windows VPS Hong Kong. Desktop editions are offered too: Windows 10 RDP and Windows 11 RDP.
Check recent system errors
PowerShellGet-EventLog -LogName System -Newest 20 | Where-Object { $_.EntryType -eq 'Error' }
When a service fails, the System log usually explains why. This command lists the 20 most recent entries and keeps the errors only. Get-EventLog exists in Windows PowerShell 5.1 but not in recent PowerShell versions; if the command is unknown on your system, use this equivalent:
PowerShellGet-WinEvent -FilterHashtable @{ LogName = 'System'; Level = 2 } -MaxEvents 20
Look at the time of each event and compare it with the moment the service stopped, then read the message, which often names the missing file, the wrong account or the port already in use.
Troubleshooting
- Access denied: you are not running PowerShell as Administrator. Close the window and reopen it with elevated rights.
- Cannot find any service with the name: the software is probably not installed, or the name is wrong. List services and check the exact
Name. - The service starts and stops immediately: read the System log. Common causes are a configuration error, a port already used by another program, or a missing dependency.
- Cannot stop a service because of dependents: stop the dependent services first, or use
-Forceif you accept that they stop as well. - A service is stuck in a starting or stopping state: wait a minute, and if it stays so, restart the server in a controlled way.
Solid administration! 🚀