Automatically Clear Pagefile at Shutdown in Windows 7

The virtual memory support in Windows uses a system pagefile to swap pages of memory to disk when they are not used. When Windows is running, this pagefile is opened exclusively by the operating system, and it is well protected. But if you have a multi-boot system then the sensitive information contained in this pagefile can be accessed by an unauthorized user through another operating system. But you can make Windows 7 to automatically clear the pagefile and the hibernation file upon a clean shutdown to prevent such attempts. Here is how :

Note : This requires you to have administrator level access.

Method 1

  1. Press the key combination Windows logo key + R to open the Run dialog.
  2. In the Run Dialog, type gpedit.msc and press Enter to open the Group Policy Editor.

    Run Dialog in Windows 7

  3. In the Group Policy Editor, open Computer Configuration → Windows Settings → Security Settings → Local Policies → Security Options as shown.

    Pagefile options in Policy Editor

  4. Double-click on Shutdown : Clear virtual memory pagefile in the right side pane. In the window that opens up, select Enabled option.

    Set pagefile to auto-clear in Policy Editor

  5. Click OK to save the settings.

Method 2

  1. Open an elevated command prompt. You might see the UAC (User Account Control) window – choose Yes.
  2. In the elevated command prompt, type the following exactly as shown and press Enter.
    REG ADD “HKLM\System\CurrentControlSet\Control\Session Manager\Memory Management” /v ClearPageFileAtShutdown /t REG_DWORD /d 1 /f
  3. Now you can close the command prompt window.

Method 3

  1. Press the key combination Windows logo key + R to open the Run dialog.
  2. In the Run Dialog, type regedit.exe and press Enter to open the Registry Editor.

    Open Registry Editor in Windows 7

  3. In the Registry Editor, navigate to the following key :
    HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Memory Management
  4. In the right-side pane, you would find a DWORD value ClearPageFileAtShutdown as shown.

    Set pagefile to auto-clear in Registry Editor

  5. Double-click on ClearPageFileAtShutdown and set its value to 1.
  6. That’s it. Now, the virtual memory pagefile will be cleared everytime you will perform a clean shutdown.

Leave a Reply

Your email address will not be published. Required fields are marked *