How to delete the Windows 10 paging file on every shutdown

A simple tweak of the Windows 10 Registry file can eliminate one often overlooked security concern.

istock-939548898shutdown.jpg
Image: FORGEM, Getty Images/iStockphoto

Survey after survey tells us that IT professionals and decision-making executives all over the world who work in enterprises of all sizes are most often concerned about security and protecting data. Whether it is enacting draconian access authentication procedures, deploying extraordinary efforts to close security vulnerabilities, or implementing unproven artificial intelligence (AI) systems, those IT pros say something must be done to protect the huge amount of data generated by modern businesses.

One often overlooked potential security vulnerability, albeit a small one, is the existence of the Microsoft Windows 10 paging file on just about every PC in an enterprise. Typically, the paging file (pagefile.sys) takes up space on your primary hard drive and acts as a form of virtual memory for the operating system, freeing up the physical RAM for higher priority applications, drivers, files, etc. Unless you change it, the Windows 10 paging file remains on your hard drive even after shutting down.

SEE: 10 tricks and tweaks for customizing Windows 10 (free PDF) (TechRepublic)

This how-to tutorial shows you how to tweak the Windows 10 Registry file to force the deletion of pagefile.sys every time you shut down your computer, thereby removing any potential security vulnerabilities. With this method, the next time you start your Windows 10 computer, the paging file will be recreated with new data.

Disclaimer: Editing the Windows Registry file is a serious undertaking. A corrupted Windows Registry file could render your computer inoperable, requiring a reinstallation of the Windows 10 operating system and potential loss of data. Back up the Windows 10 Registry file and create a valid restore point before you proceed.

How to delete the pagefile.sys file in Windows 10

To see what your current paging file settings are, follow these steps:

1. Open File Explorer and right-click Computer.

2. Select Properties.

3. Click on Advanced system settings (Figure A).

adeletepagefileonshudown.png
Figure A

4. Click the Settings button under the Performance section and then click the Advanced tab. You should see a screen similar to Figure B. Your current settings for the Windows 10 paging file will be displayed under the Virtual Memory section. In the example, the paging file is currently set to be about 16 GB.

5. Click OK a couple of times to close those screens.

bdeletepagefileonshudown.png
Figure B

6. Start the Registry file tweaking process by typing "regedit" into the Cortana search box on the Windows 10 desktop.

7. Click the entry in the search results that refer to the Registry Editor program (regedit.exe).

8. With the app open, navigate to this specific key (Figure C):

Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management

cdeletepagefileonshudown.png

Figure C

9. In the right-hand window, double-click the ClearPageFileAtShutdown key and change the current default value from zero ("0") to "1" (Figure D).

ddeletepagefileonshudown.png
Figure D

From this point on, until you change it back to zero ("0"), the paging file will be completely deleted on shutdown and then restarted fresh each time you start Windows 10.

Also see