Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to run a script to move users page files from C: to D: (if they don't have enough space)

I've figured out how to do it by modifying HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PagingFiles

It works fine - a new page file is created on D:

But, the old page file isn't removed from C: on reboot (although it works fine if I make the change manually). After reboot I can actually delete it though, so it's no still in use - just hasn't been removed.

Is there a way to make that happen?

share|improve this question
up vote 1 down vote accepted

You shouldn't be hacking the registry to do this. You should be making the changes the correct way, by using the relevant win32 classes.

The classes you are looking for are Win32_PageFile and Win32_PageFileSetting.

share|improve this answer
Oh, nice - I hadn't noticed that. The PageFile link, btw, says that particular class is deprecated. – christianlinnell Nov 9 '09 at 2:01
It'll still work - not sure what it's been superseded by - have had a look and can't find anything. – Izzy Nov 9 '09 at 2:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.