I'm trying to write a C#/.NET application that optimizes the hard drives for our XP workstations
- Set pagefile to "No paging file"
- Reboot
- Run a defrag utility to optimize the data and apps
- Create a contiguous page file
- Reboot, run pagedefrag from Sysinternals
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.