Wipe the page file at every shutdown — via Microsoft Learn
A security option that overwrites pagefile.sys on a clean shutdown, so fragments of memory (which can include passwords or documents) can't be read by someone who boots another OS or removes the drive. The price is a noticeably slower shutdown on PCs with a large page file.
Takes effect right away
Group Policy
Open gpedit.msc (Pro, Enterprise and Education only) and go to:
Computer Configuration > Windows Settings > Security Settings > Local Policies > Security Options > Shutdown: Clear virtual memory pagefile
Registry equivalent
Double-click a .reg file and confirm to merge it. Right-click → Edit first if you want to read it, which is always a good idea with any .reg file from the internet.
Apply
Windows Registry Editor Version 5.00
; Oddbyte.Me: Wipe the page file at every shutdown
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management]
"ClearPageFileAtShutdown"=dword:00000001Undo
Windows Registry Editor Version 5.00
; Oddbyte.Me: undo Wipe the page file at every shutdown
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management]
"ClearPageFileAtShutdown"=dword:00000000Same thing from a command prompt
Run in an administrator Command Prompt or Terminal.
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v "ClearPageFileAtShutdown" /t REG_DWORD /d 1 /fUndo:
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v "ClearPageFileAtShutdown" /t REG_DWORD /d 0 /fOff by default. With it on, the hibernation file is also zeroed when hibernation is disabled. Most useful on dual-boot PCs or where someone could boot another OS from USB. If shutdowns suddenly take ages, check this value first.
Sources
- Policy CSP - LocalPoliciesSecurityOptions: Shutdown_ClearVirtualMemoryPageFile — by Microsoft Learn
- Windows shuts down slowly when set to clear the virtual memory pagefile — by Microsoft Learn
- Troubleshoot system shutdown that stops responding — ClearPageFileAtShutdown — by Microsoft Learn
- Source reviewed
- 2026-11-02
- Link checked
- 2026-11-02
- Tested hands-on
- Not by Oddbyte.Me
Oddbyte.Me hasn't tried this on every Windows build, so keep the undo handy.