I'm trying to write a C#/.NET application that optimizes the hard drives for our XP workstations
I'm really struggling with #1. I delete the following key: SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PagingFiles
Upon reboot, the System Control Panel shows "No page file", but c:\pagefile.sys still exists and its in use by the SYSTEM process so I can't delete it and I can't optimize HD. I tried using PendingFileRenamingOperations and that bombs out too. I tried using WMI: Win32_PageFileSetting, but that only lets you set sizes (not zero--defaults to 2MB).
Of course, if I do the manual steps outlined above, it works.
I think I need an API call to make this happen.
Right click on pagefile. sys and choose 'Delete'. If your pagefile is particularly large, the system may have to delete it immediately without sending it to the Recycle Bin. Once the file has been removed, restart your PC.
Choose the Advanced tab in the Performance Options dialog, and click the Change… button in the Virtual Memory section. In the Virtual Memory dialog, uncheck the “Automatically manage paging file size for all drives”. Then configure pagefiles so that any DataKeeper-protected volumes have no page file configured.
Pagefile in Windows 10 is a hidden system file with the . SYS extension that is stored on your computer's system drive (usually C:\). The Pagefile allows the computer to perform smoothly by reducing the workload of the physical memory, or RAM.
Look at Delete
or DeleteEx methods of the Win32_PageFile
class:
The class has been deprecated but since you're talking about Windows XP, maybe it wasn't deprecated then.
Actually, the mistake I made was delete the registry key.
What I had to do is set the multi-string value to something like
rk.SetValue("PagingFiles", new string[]{""}, RegistryValueType.MultiString)
Good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With