How to encrypt and clear Windows page file

When you are operate your computer the files you are managing will be temporarily stored in volatile RAM memory, once you close the files you are working on the occupied RAM memory will clear itself and be available again.

Computer’s RAM memory (all computers have it) can run out, when this happens Windows will use what it is known as Windows page or swap file. This file is an internal Windows operating system file where temporary data is stored for the operating system to have quick read and write access.

Using the page file has two implications, one is that it slows down your computer because the data is being read from the hard disk (slower than RAM memory) and two is that data written to the Windows page file can be recovered via specialist software, data stored in the Windows page file can include passwords and all kind of personal files, but if Windows did not have any page file and you exhausted your RAM memory, the computer would crash.

How to locate and resize pagefile.sys

Windows swap memory filename is pagefile.sys it is not visible to users and hard to locate, you can increase or decrease Windows default page file size or stop using it through Windows control panel, you might need to do this depending on how much RAM memory your computer has installed and how much you use, a bigger page file is suitable for those low on RAM and setting a smaller page file size will give you hard disk space back.

In Windows Vista go to the Start Windows logo>Control Panel>System and Maintenance>System

Where it says “Computer name, domain and workgroup settings” click on Settings, a new window will open asking you for administrator rights, on the new window click on the Advanced tab, right below where it says Perfomance click on Settings click on Advanced you will say that it says “Virtual memory and total paging file size for all drives” that is where you can change Windows page file size or instruct Windows not to use a page file at all.

Windows Vista page file settings

Windows Vista page file settings

If you choose not to use a page file when your RAM memory runs out Windows will crash, if you have a high amount of RAM, like 8GB and do not run virtual memory intensive applications like high end games and graphic editors, you should never run out of RAM and it is safe to disable the Windows page file.

How to encrypt Windows page file

Your Windows operating system comes with a program installed called fsutil you can access it using Windows cmd command line, it is very important that you run Windows cmd as administrator, otherwise you won’t be able to encrypt the Windows page file.

To run cmd as an administrator go to Start Windows logo>All programs>Accessories>Command prompt (right click on it and choose “Run as administrator“) Windows command line black window will open.

To encrypt Windows page file type:

fsutil behavior set EncryptPagingFile 1

Before encryption takes place your computer needs to be rebooted.

Windows page file encryption

Windows page file encryption

To check if Windows page file is encrypted type:

fsutil behavior query EncryptPagingFile

The value 1 indicates that the page file is encrypted, a value of 0 indicates that it is not.

If something doesn’t work or you change your mind you can decrypt Windows page file typing:

fsutil behavior set EncryptPagingFile 0

When you encrypt Windows page file built-in Windows EFS (Encrypting File System) is used, the needed encryption keys are created and erased by Windows as needed, this only works in hard disks formatted with the NTFS file system (not FAT).

How to clear Windows page file

You can tell Windows to erase its virtual memory, aka page file, every time you shut down the computer, but be aware that this will slightly slow down the shutdown process.

Registry editor ClearPageFileAtShutdown

Registry editor ClearPageFileAtShutdown

To automatically clear Windows page file contents on shut down invoke the registry editor, go to Windows Run using the Windows key on your keyboard +R, alternatively go to Start>All Programs>Accessories>Run, type regedit click enter and the Windows registry will open in a new window.

Navigate to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\

You will see a DWORD value “ClearPageFileAtShutdown”, double-click on it and change value data from “0” to “1″, if you want to reverse the changes later on change the value back to “0“.

Securely erasing the page file contents can only be done using specialist privacy data wiping software that will overwrite its contents, the system above will clear the page file contents but they will still be recoverable until the page file has been used, and overwritten, again.

Leave a Reply