WindowsPublished on May 28, 20267 min read

Preventing a Windows VPS from going to sleep in 2026

Does your Windows VPS stop responding a few minutes after you close the RDP session, or does your script stop on its own? Windows sleep settings and Remote Desktop timeouts are often to blame. This guide shows how to keep a Windows VPS from going to sleep with powercfg, the power settings, a PowerShell script or the registry, then how to check the result. The commands target Windows Server 2025, the system delivered on OuiHeberg Windows VPS. They also work on Windows Server 2019 and 2022.

For a quick fix, these commands are enough in most cases. Run them in PowerShell as administrator, then restart the VPS.

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-a6e23a8c635c

Why a Windows VPS goes to sleep

A VPS is a virtual machine, with no screen, keyboard or battery. Yet Windows applies its default power plan, designed for a workstation. Several mechanisms can then interrupt your work.

  • After a period of inactivity, Windows turns off the virtual display.

  • Later, it may go to sleep or hibernate. Processes freeze and network services slow down.

  • Remote Desktop applies its own timeouts (MaxIdleTime, MaxDisconnectionTime) and closes idle sessions.

On a virtual machine, sleep states are not always available. This command lists the ones the system can use.

powercfg /availablesleepstates

Typical symptoms are as follows. The server still answers ping, but RDP refuses the connection or shows a black screen. Scheduled tasks stop. Graphical apps, such as a bot, an automated browser, MetaTrader or OBS, pause. So disable sleep and these timeouts before going to production.

Make every change from an RDP session with an administrator account. With a standard account, some settings are greyed out.


Set power options in the interface

Choose the High performance plan

  1. Press Windows + R, type powercfg.cpl, then Enter. The Power Options window opens.

  2. Select the High performance plan.

If it is missing, recreate it in PowerShell as administrator.

powercfg -duplicatescheme 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
powercfg /setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c

Turn off the display and sleep

  1. Click Change plan settings next to the active plan.

  2. Set Turn off the display and Put the computer to sleep to Never.

  3. Click Change advanced power settings.

In the advanced window, set these options, then click Apply and OK.

SectionSettingValue
Hard diskTurn off hard disk afterNever (0 min)
SleepSleep afterNever
SleepAllow hybrid sleepOff
SleepHibernate afterNever
SleepAllow wake timersDisable
USB settingsUSB selective suspend settingDisabled

Some settings do not show up on a virtual machine. Skip the missing ones.

Turn off fast startup

In Power Options, click Choose what the power buttons do, then Change settings that are currently unavailable. Untick Turn on fast startup. On Windows Server this option is often missing, in which case there is nothing to do.


Disable everything with a PowerShell script

This is the fastest and most reliable method. One block replaces the whole graphical procedure and gives the same settings on all your VPS. Open PowerShell as administrator and paste the script.

# === Windows VPS: fully disable sleep ===

# 1. "High performance" plan
$highPerf = "8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c"
powercfg -duplicatescheme $highPerf 2>$null
powercfg /setactive $highPerf

# 2. All timeouts to zero (AC power, the only mode of a 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 removes hiberfil.sys)
powercfg /hibernate off

# 4. Disable wake timers
powercfg /setacvalueindex SCHEME_CURRENT SUB_SLEEP RTCWAKE 0
powercfg /setactive SCHEME_CURRENT

# 5. Disable the screen saver (current user)
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. RDP timeouts to zero (no session limit)
$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 "`nSettings applied. Restart recommended." -ForegroundColor Green

Only the -ac settings (plugged in) matter: a VPS always counts as plugged in, so the -dc settings (on battery) can be ignored. The powercfg /hibernate off command also deletes the hiberfil.sys file, which takes up disk space close to a large share of the memory.

Save this script as C:\Scripts\disable-sleep.ps1 to apply it again on a new VPS.


Edit the registry by hand

The registry gives finer control, useful to solve a conflict with a group policy.

Disable RDP timeouts

Press Windows + R, type regedit, then go to this key.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp

Create or edit these three DWORD (32-bit) values.

NameTypeValueEffect
MaxIdleTimeDWORD0The session is never closed for inactivity
MaxDisconnectionTimeDWORD0A disconnected session stays open without limit
MaxConnectionTimeDWORD0No maximum connection time

Disable fast startup

In this key, set HiberbootEnabled (DWORD) to 0.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Power

Check the settings

Restart the VPS, log back in, then run this check script in PowerShell as administrator.

shutdown /r /t 0
# === Settings check ===
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 get these results.

  • The active plan is High performance, GUID 8c5e7fda-….

  • All timeout Index lines show 0x00000000.

  • Hibernation shows as not enabled.

  • MaxIdleTime, MaxDisconnectionTime and MaxConnectionTime are 0.

These settings survive restarts. A major Windows update can still reset some Remote Desktop keys, so run the script again in that case.


If the VPS still freezes

If the VPS still becomes unreachable after a few hours despite these settings, the cause probably lies elsewhere. Here are the most common ones, from most to least likely.

Windows Update forces a restart

Check that no automatic restart is planned during your critical hours. This key stops Windows Update from restarting while a session is open.

reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v NoAutoRebootWithLoggedOnUsers /t REG_DWORD /d 1 /f

Scheduled tasks restart the machine

Open taskschd.msc and look at Microsoft\Windows\UpdateOrchestrator and Microsoft\Windows\Maintenance. If you handle updates yourself, disable the Reboot and RegularMaintenance tasks.

The network adapter saves power

Open devmgmt.msc, then Network adapters. Right-click the interface, then Properties. On the Power Management tab, untick Allow the computer to turn off this device to save power. A virtual adapter does not always have this tab.

A group policy enforces timeouts again

If the VPS is joined to a domain or you set local policies, open gpedit.msc and go to this folder.

Computer Configuration › Administrative Templates › Windows Components › Remote Desktop Services › Remote Desktop Session Host › Session Time Limits

Set every session limit policy to Not Configured or Disabled, then run gpupdate /force.

An update reset Remote Desktop

Run the PowerShell script again after each major update. If needed, schedule it once a month.


Keep the RDP session alive

Even while open, a disconnected session can see its processes pushed to the background. Two settings on the VPS help keep it alive.

Turn on Remote Desktop keep-alive

This policy makes the server send a regular signal, so a router or NAT does not drop an idle connection. It is also in gpedit.msc, in the Connections folder of the session host.

# "Configure keep-alive connection interval" policy, interval in minutes
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v KeepAliveEnable /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v KeepAliveInterval /t REG_DWORD /d 1 /f

Prevent automatic locking

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

  • High performance power plan.

  • standby-timeout-ac set to 0.

  • monitor-timeout-ac set to 0.

  • Hibernation disabled (powercfg /hibernate off).

  • MaxIdleTime set to 0 in the RDP registry key.

  • Fast startup disabled.

  • Network adapter power saving unticked, if the option exists.

  • VPS restarted at least once after the setup.

If everything is ticked, your Windows VPS stays awake all the time, even with the RDP session closed.


Need help?

Open a ticket from Tickets › Open a Ticket, or from the Contact support tile at the bottom of the VPS page. In the Related Service field, pick the VPS so the team saves time. You can also ask your question on the OuiHeberg Discord.

Was this article helpful?

489 views
Share this article
Need a Windows VPS?

Windows Server 2025 with the license included, Remote Desktop access and management from the client area.

View plans →
Need a Windows VPS?

Windows Server 2025 with the license included, Remote Desktop access and management from the client area.

View plans →

Related Articles