Via group policy or via registry, the page file can be set to be cleared on shutdown.
- Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management
- Select ClearPageFileAtShutdown from the list on the right.
- Right on it and select Modify.
- Change the value to 1 to enable.
However I have not yet been able to really figure out how this will work when pagefile resides on a SSD.
On normal HDD there is no lack of understanding, the pagefile gets overwritten during shutdown. However we know overwriting or wiping on a SSD does not really work as there is no control how data is distributed on storage cells. So I am wondering how this feature is implemented that the pagefile in fact gets overwritten / cleared. I have not found anything on the web that specifically addresses this feature in regards to a SSD, so if someone with more insight into this could please enlighten me.
If some Microsoft tech is going to answer this, I am having an additional question related to the previous one: Pagefile has the feature to be encrypted. Now when clearing pagefile on shutdown, why is it even necessary to overwrite the pagefile? Wouldn't it be way smarter and faster, if on shutdown the encryption key for the pagefile encryption gets destroyed?
The only reason I can think if why it is not handled that way is that it is the same key that is used for EFS encryption on the system. So an implementation that created a onetime encryption key only for the page file that can be safely destroyed on shutdown, would bring an incredible performance boost for the shutdown process as overwriting would no longer be required to turn the pagefile into pure garbage.