0

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?

1 Answer 1

1

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.

2
  • Oh, nice - I hadn't noticed that. The PageFile link, btw, says that particular class is deprecated. Nov 9, 2009 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, 2009 at 2:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .