Programs started from a Remote Desktop session stop when that session ends or the server reboots for updates. Windows services start with the system, run without a user, and can restart themselves after a crash. Converting long-running applications into services is one of the most effective reliability improvements on a Windows server.
Services vs Startup Programs vs Scheduled Tasks
| Mechanism | Runs without login | Auto-restart on crash | Best for |
|---|---|---|---|
| Windows service | Yes | Yes (recovery options) | Always-on background apps, listeners, workers |
| Scheduled task | Yes (if configured) | Limited (restart settings) | Jobs that run and exit on a schedule (see our automation guide) |
| Startup folder / Run key | No (needs logon) | No | GUI apps that genuinely need a desktop |
Option 1: Build a Real Service
If you control the code, build it as a service. In .NET, the Worker Service template with UseWindowsService() produces an app that runs as a service and responds to start and stop correctly:
// Program.cs
var builder = Host.CreateApplicationBuilder(args);
builder.Services.AddWindowsService(o => o.ServiceName = "Order Sync");
builder.Services.AddHostedService<Worker>();
builder.Build().Run();
sc.exe create "OrderSync" binPath= "D:\services\ordersync\OrderSync.exe" start= delayed-auto
sc.exe description "OrderSync" "Syncs orders from the shop API to the ERP"
Option 2: Wrap an Existing Executable
Many tools, scripts and third-party programs were not written as services. Service wrappers run them as one:
# NSSM (Non-Sucking Service Manager)
nssm install BotRunner "C:\Program Files\nodejs\node.exe" "D:\apps\bot\index.js"
nssm set BotRunner AppDirectory D:\apps\bot
nssm set BotRunner AppStdout D:\apps\bot\logs\out.log
nssm set BotRunner AppStderr D:\apps\bot\logs\err.log
nssm set BotRunner AppRotateFiles 1
nssm start BotRunner
WinSW is an alternative configured with an XML file. Both restart the wrapped program if it exits and capture its output to log files.
Recovery Options
sc.exe failure "OrderSync" reset= 86400 actions= restart/5000/restart/10000/restart/60000
This restarts the service after 5 and 10 seconds for the first two failures and after a minute for later ones, resetting the failure count daily. Combine it with alerts so repeated crashes are noticed rather than silently retried forever.
Service Accounts
- Avoid running services as LocalSystem unless required; it has full control of the machine.
- Use a dedicated local account, or a virtual account (
NT SERVICE\ServiceName), with only the folder and network permissions the service needs. - Grant the "Log on as a service" right to custom accounts.
What About GUI Applications?
Services run in session 0 without a desktop, so applications that need a visible window (some trading terminals, browser automation with a visible browser, legacy GUI tools) do not work as services. For those, use an auto-logon user session with the app in Startup, or a scheduled task at logon, and keep the session disconnected rather than signed out. Prefer headless modes where the software supports them.
Logging
Write logs to a dedicated folder with rotation, or to the Windows Event Log (EventLog provider in .NET). Include timestamps and enough context to diagnose overnight failures, and keep log size under control so the disk never fills.
Graceful Stop and Updates
Windows sends a stop request when the service is stopped or the server shuts down, and waits a limited time. Handle it: finish the current unit of work, save state, close connections and exit. To update, stop the service, replace binaries (or switch a folder), start it again and check its logs.
Monitoring Services
- Event Viewer → System log for Service Control Manager errors (crashes, failed starts).
- A heartbeat from the service to an external monitor for critical workloads.
- A simple scheduled PowerShell check that alerts if
Get-Serviceshows a critical service stopped.
Sizing
| Workload | RDP plan |
|---|---|
| A few light services and scripts | Plan 1: 4 vCores, 8 GB (₹999) |
| Services holding data in memory or many workers | Plan 2: 6 vCores, 16 GB (₹1,799) |
| Services alongside users, SQL Server or ERP | Plan 3 or 4 |
Common Mistakes
- Running background apps in an RDP session that ends at logout or reboot.
- Services as LocalSystem by default.
- No recovery options or alerts, so a crash goes unnoticed.
- Logs written to the program folder without rotation.
- Using mapped drives that do not exist for the service account; use UNC paths.
In Short
Run always-on applications as services with automatic start, recovery actions, least-privilege accounts, rotated logs and graceful shutdown, and monitor them so failures are noticed.
Example: A Shop-to-ERP Sync Service
A retailer needs orders from its online shop copied into its Windows ERP every few minutes. The sync program, written in .NET, runs as a Worker Service under a virtual account with access only to its folder and the ERP's import directory. Recovery options restart it if it crashes; it writes structured logs with rotation; and it pings a heartbeat URL after each successful sync. When a shop API change once broke the sync, the heartbeat alert reached the developer within ten minutes, long before customers or staff noticed missing orders.
Next Steps
List the programs that must run without anyone logged in, decide whether each should be a native service, a wrapped executable or a scheduled task, and convert them one at a time, checking logs and recovery behaviour after each change.
Security for Service Accounts
Every service account is a potential entry point. Give each service its own account, grant only the rights it needs, deny interactive logon where possible, store any credentials it uses in a protected store rather than configuration files, and review service accounts whenever applications change. Services that listen on network ports should be firewalled to the addresses that need them, and never exposed to the whole internet without authentication.
Bottom Line
A properly configured service turns a fragile background program into dependable infrastructure. Write the setup down in a short runbook stored with your scripts or code, covering how the server is built, where data and credentials live, how to restore from backup and whom to contact, so anyone on the team can recover it quickly if the person who built it is unavailable.
SkyRainCloud Plans for This Workload
Background services are usually light: RDP Plan 1 (4 vCores, 8 GB, ₹999) runs several. Size up when services hold large data in memory, drive browsers or share the server with users.
Windows RDP
Windows RDP servers in India with full Administrator access and a 1 Gbps unmetered uplink.
| Plan | vCores | RAM | Storage | Network | Price | Good for | Buy |
|---|---|---|---|---|---|---|---|
| RDP Plan 1 | 4 | 8 GB DDR4 | 60 GB Enterprise Disk | 1 Gbps, unmetered | ₹999/month | Data entry, virtual assistants, one MetaTrader terminal | Order |
| RDP Plan 2 | 6 | 16 GB DDR4 | 80 GB Enterprise Disk | 1 Gbps, unmetered | ₹1,799/month | Tally Prime for small teams, several browser profiles or terminals | Order |
| RDP Plan 3 | 8 | 24 GB DDR4 | 120 GB Enterprise Disk | 1 Gbps, unmetered | ₹2,499/month | Multi-user remote work, automation and SEO tools | Order |
| RDP Plan 4 | 12 | 32 GB DDR4 | 160 GB Enterprise Disk | 1 Gbps, unmetered | ₹3,499/month | Remote teams, large ERP datasets, many concurrent sessions | Order |
Prices are monthly in INR as listed on the SkyRainCloud store (verified 2026-11-14). Stock and final pricing are shown on the product page at checkout.