Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.