You connect to your Windows VPS via RDP, you start a process, you log off… and a few minutes later, your server is unresponsive, your script has stopped, or the remote desktop connection refuses to open. The culprit is almost always the same: Windows sleep mode.
This guide explains why a Windows VPS goes to sleep (which makes no sense on a remote server), and then provides three complementary methods to disable it permanently: graphical interface, scripted PowerShell, and Windows registry. By the end of the article, your VPS will remain active 24/7, even with the RDP session closed.
Quick solution in 30 seconds:
Open PowerShell as administrator on your VPS and paste:
powercfg /change standby-timeout-ac 0 powercfg /change monitor-timeout-ac 0 powercfg /change hibernate-timeout-ac 0 powercfg /hibernate off powercfg /setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635cThen restart. Details, verification, and troubleshooting below.
Why does a Windows VPS go to sleep (when it shouldn't)
A VPS is a virtual machine running on a hypervisor (KVM, VMware, Hyper-V). Unlike a physical PC, it has no screen, no keyboard, no battery. Sleep mode makes no functional sense… but Windows doesn't know that.
When you install Windows Server (or worse, Windows 10/11 on a VPS, which some do), the system applies its default power plan, designed for a workstation. Consequences:
- After 15-30 minutes of RDP session inactivity, Windows assumes there is "no one" and turns off the virtual screen.
- After ~1h, it goes to sleep (
Sleep) or hibernates (Hibernate) → the OS suspends threads, network services slow down, some user processes freeze. - The Remote Desktop service (TermService) applies its own timeouts (
MaxIdleTime,MaxDisconnectionTime) which close the session after inactivity, freeing the desktop.
On a VPS, the observed behavior is generally:
- ✗ The server still responds to ping (the network kernel remains active).
- ✗ RDP refuses the connection or displays a black screen.
- ✗ Your scheduled scripts/services stop.
- ✗ GUI applications (bots, automated browsers, MetaTrader, OBS, etc.) pause.
This is why any production deployment on a Windows VPS starts with disabling sleep. Let's see how, cleanly and sustainably.
Prerequisites
- An active Windows VPS (Windows Server 2019, 2022, 2025 or Windows 10/11) such as a OuiHeberg Windows VPS.
- RDP access to the server with an administrator account.
- 5 to 10 minutes.
Note: All manipulations must be done from an administrator RDP session. If you are using a standard account, some settings will be grayed out.
Method 1 - Graphical interface (recommended for beginners)
Step 1.1 - Open power options
- Press
Windows + Rto open the Run window. - Type
powercfg.cplthenEnter. - The Power Options window opens.
Step 1.2 - Choose the "High performance" mode
In the list of modes, select High performance.
If it does not appear (common case on Windows Server with reduced power plan), recreate it via PowerShell admin:
powercfg -duplicatescheme 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
powercfg /setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
Step 1.3 - Disable screen and sleep
- Click on Change plan settings to the right of the active plan.
- Set Turn off the display to
Never. - Set Put the computer to sleep to
Never. - Click on Change advanced power settings.
Step 1.4 - Advanced settings (most important)
In the advanced window, configure:
| Section | Parameter | Value |
|---|---|---|
| Hard disk | Turn off hard disk after | Never (0 min) |
| Sleep | Sleep after | Never |
| Sleep | Allow hybrid sleep | Disabled |
| Sleep | Hibernate after | Never |
| Sleep | Allow wake timers | Disabled |
| USB | USB selective suspend setting | Disabled |
| Buttons and lid | Action when closing the lid | Do nothing |
Click on Apply then OK.
Step 1.5 - Disable fast startup
- In Power Options, click on the left Choose what the power buttons do.
- Click on Change settings that are currently unavailable.
- Uncheck Turn on fast startup.
Method 2 - PowerShell script (recommended for admins)
This is the fastest and most reliable method. A single PowerShell block replaces the entire graphical procedure and ensures the same configuration across all your VPS.
Open PowerShell as administrator, copy and paste the entire script below:
# === OuiHeberg — Windows VPS: complete sleep deactivation ===
# 1. "High performance" power plan
$highPerf = "8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c"
powercfg -duplicatescheme $highPerf 2>$null
powercfg /setactive $highPerf
# 2. Disable all timeouts (AC sector, the only valid one on VPS)
powercfg /change standby-timeout-ac 0
powercfg /change monitor-timeout-ac 0
powercfg /change disk-timeout-ac 0
powercfg /change hibernate-timeout-ac 0
# 3. Disable hibernation (also frees hiberfil.sys = several GB)
powercfg /hibernate off
# 4. Disable wake timers
powercfg /setacvalueindex SCHEME_CURRENT SUB_SLEEP RTCWAKE 0
powercfg /setactive SCHEME_CURRENT
# 5. Disable screensaver for all users
reg add "HKCU\Control Panel\Desktop" /v ScreenSaveActive /t REG_SZ /d 0 /f
reg add "HKCU\Control Panel\Desktop" /v ScreenSaveTimeOut /t REG_SZ /d 0 /f
# 6. Disable RDP timeouts (session remains open indefinitely)
$rdp = "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp"
Set-ItemProperty -Path $rdp -Name "MaxIdleTime" -Value 0 -Type DWord
Set-ItemProperty -Path $rdp -Name "MaxDisconnectionTime" -Value 0 -Type DWord
Set-ItemProperty -Path $rdp -Name "MaxConnectionTime" -Value 0 -Type DWord
# 7. Disable fast startup (HiberbootEnabled)
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Power" /v HiberbootEnabled /t REG_DWORD /d 0 /f
Write-Host "`n✓ Configuration applied. Restart recommended." -ForegroundColor Green
Save this script in C:\Scripts\disable-sleep.ps1 so you can reapply it on any new VPS.
Method 3 - Registry Editor (for specific cases)
If you want granular control or resolve a GPO conflict, edit the registry directly.
Disable RDP timeouts
Windows + R → regedit → navigate to:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp
Create/modify these three DWORD (32-bit) values:
| Name | Type | Value | Effect |
|---|---|---|---|
MaxIdleTime | DWORD | 0 | Session never closed for inactivity |
MaxDisconnectionTime | DWORD | 0 | Disconnected session remains indefinitely |
MaxConnectionTime | DWORD | 0 | No maximum connection duration |
Disable fast startup via registry
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Power
Set HiberbootEnabled (DWORD) to 0.
Verification: is your VPS properly configured?
After the changes, restart the VPS (shutdown /r /t 0), reconnect, and then run this verification script in PowerShell admin:
# === VPS sleep configuration verification ===
Write-Host "`n--- Active power plan ---" -ForegroundColor Cyan
powercfg /getactivescheme
Write-Host "`n--- Timeouts ---" -ForegroundColor Cyan
powercfg /query SCHEME_CURRENT SUB_SLEEP STANDBYIDLE | Select-String "Index"
powercfg /query SCHEME_CURRENT SUB_VIDEO VIDEOIDLE | Select-String "Index"
Write-Host "`n--- Hibernation ---" -ForegroundColor Cyan
powercfg /availablesleepstates
Write-Host "`n--- RDP Timeouts ---" -ForegroundColor Cyan
Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" |
Select-Object MaxIdleTime, MaxDisconnectionTime, MaxConnectionTime
You should see:
- Active plan =
High performance(GUID8c5e7fda-…) - All
Indextimeouts at0x00000000 Hibernation has not been enabledMaxIdleTime,MaxDisconnectionTime,MaxConnectionTimeat0
If any of these points are not compliant, see the troubleshooting section.
Troubleshooting - The VPS keeps "freezing"
If despite the configuration above the VPS remains unreachable after a few hours, the problem likely comes from somewhere other than sleep. Here are the most common causes in order of probability.
1. Windows Update forces a restart
services.msc → find Windows Update → check that automatic restart is not scheduled during your critical hours. To postpone:
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v NoAutoRebootWithLoggedOnUsers /t REG_DWORD /d 1 /f
2. Scheduled shutdown/restart tasks
taskschd.msc → Task Scheduler Library → check Microsoft\Windows\UpdateOrchestrator and Microsoft\Windows\Maintenance. Disable Reboot and RegularMaintenance if you manage updates manually.
3. Network card allowed to "save power"
devmgmt.msc → Network adapters → right-click on the interface → Properties → Power Management tab → uncheck "Allow the computer to turn off this device to save power".
4. Group policy (GPO) that reimposes timeouts
If your VPS is joined to a domain or if you have applied Local Group Policy GPOs, open gpedit.msc and check:
Computer Configuration → Administrative Templates → Windows Components → Remote Desktop Services → Remote Desktop Session Host → Connection Limits
Disable (or set to Not Configured) all policies related to session limits. Then run gpupdate /force.
5. TermService service restarted by updates
Reapplying the PowerShell script from method 2 resets the RDP keys after each major Windows update. Schedule it as a monthly task if necessary.
Further: keep the RDP session active without closing it
Even with an active session, some services (antivirus, telemetry) may lower the priority of user processes when the session is "disconnected but open". Two tips:
Keep the RDP session "alive" on the client side
On your local PC (not the VPS), create a .rdp shortcut with these options:
keepalive interval:i:60
disconnection sound:i:0
This sends an RDP ping every 60 seconds and prevents the box/NAT from cutting the connection.
Prevent automatic lock screen
Still on the VPS, as admin:
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v InactivityTimeoutSecs /t REG_DWORD /d 0 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Personalization" /v NoLockScreen /t REG_DWORD /d 1 /f
Final checklist - 8 checks before logging off
- Power plan = High performance
-
standby-timeout-ac= 0 -
monitor-timeout-ac= 0 -
hibernate=off -
MaxIdleTime(RDP registry) = 0 - Fast startup disabled
- Network card: "save power" unchecked
- VPS restarted at least once after configuration
If all 8 boxes are checked, your Windows VPS will remain active 24/7.
FAQ - Sleep mode of a Windows VPS
Why does a Windows VPS go to sleep when it has no screen?
Because Windows applies its default power plan (designed for a PC) without considering that the machine is virtual. Screen and sleep timeouts apply even on a VPS without physical devices, and the Remote Desktop service closes the session after inactivity.
What is the fastest command to prevent a Windows VPS from going to sleep?
A single line in PowerShell as administrator: powercfg /change standby-timeout-ac 0. For complete protection, add powercfg /change monitor-timeout-ac 0, powercfg /hibernate off, and disable RDP timeouts in the registry.
My Windows VPS is unresponsive after a few hours, is it sleep mode?
Probably, but not only. Check in this order: (1) power plan, (2) RDP timeouts MaxIdleTime, (3) scheduled Windows Update tasks, (4) network card allowed to turn off. The verification script in this article diagnoses the 4 causes in 5 seconds.
Should hibernation be disabled on a VPS?
Yes. Hibernation is unnecessary on a VPS (no battery, no RAM to save), and the hiberfil.sys file takes up the equivalent of the server's RAM on disk. The command powercfg /hibernate off disables the mechanism and immediately frees up that space.
Do the changes survive a restart?
Yes. Power plans, RDP registry, and fast startup settings are persistent. The only exception: a major Windows Server update may reset some keys of the Remote Desktop service. Reapply the PowerShell script after each Feature Update.
What is the difference between standby-timeout-ac and standby-timeout-dc?
ac = mains (plugged in), dc = battery. A VPS is always considered "plugged in" — only ac matters. Changing it is sufficient; dc can be ignored.
Does this procedure work on Windows Server 2025?
Yes. All powercfg commands and registry keys listed are identical on Windows Server 2019, 2022, and 2025, as well as on Windows 10 and 11. Only the graphical interface has slightly changed on Server 2025 (Settings → System → Power instead of Control Panel).
Conclusion
Disabling sleep mode on a Windows VPS requires three complementary actions: high performance power plan, powercfg timeouts set to zero, RDP registry keys set to zero. The PowerShell script from method 2 accomplishes all three in 5 seconds and remains valid on all modern Windows Servers.
Once these settings are applied, your VPS remains active 24/7, your scripts run uninterrupted, and your RDP session resumes instantly even after several days.
Need a reliable Windows VPS to host a bot, an application server, or a development environment? Discover OuiHeberg Windows VPS with pre-installed Windows Server 2025, immediate RDP access, NVMe SSD, and 7/7 support based in France.
