Hi,

Just got tasked to create a MSI that changes the location of the Swap/Page file from C: to D: to free up disk space. I created the MSI to make the needed changes in; (in case your interested)

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Memory Management] "PagingFiles"= D:\Pagefile.sys 2046 4092
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet003\Control\Session Manager\Memory Management] "PagingFiles"= D:\Pagefile.sys 2046 4092
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management] "PagingFiles"= D:\Pagefile.sys 2046 4092

After the reboot the new pagefile.sys is created on the root of D: but my problem is that the old pagesfile.sys remains on the C: drive taking up space. What are some ways to remove the old unneeded pagefile.sys.

Even thou it’s still a system file that remains hidden, a right mouse click and the file deletes no problem. How could a initiate a “attrib –s –h pagefile.sys command and a delete after a reboot?

Thanks!
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
Have you tried using the PendingFileRenameOperations to remove the file during reboot (startup)?

http://www.jsifaq.com/SF/Tips/Tip.aspx?id=0578
From the above link: to remove the file just leave "Line 2" blank.
Answered 04/25/2007 by: AngelD
Red Belt

Please log in to comment
0
(just throwing this out there)

You could create a CustomAction which deletes the file via a VBScript and place it in the sequence after ScheduleReboot?

This might be a sloppy way to do it, but I think it will accomplish the goal...

(maybe some of the veterans around the forum can correct me if I'm wrong?)
Answered 04/26/2007 by: JdotQ
Senior Purple Belt

Please log in to comment
0
there is a script on XP machines from MS which relocates and resizes pagefile settings.

i think from memory its called pagefile.vbs just search your sys32 folder.
Answered 04/26/2007 by: jmcfadyen
Fifth Degree Black Belt

Please log in to comment
0
pagefileconfig.vbs
Answered 04/26/2007 by: jmcfadyen
Fifth Degree Black Belt

Please log in to comment
0
Hi AngelD,

Clearing the PendingFileRenameOperations property didn’t delete the file. I must have not done it right but thank you!
Answered 04/27/2007 by: Trooper23
Orange Belt

Please log in to comment
0
Hey JdotQ,

I created a AutoIt EXE that did the attrib and delete command, thanks for the idea. I added a RunOnce registry entry that did the job. Thanks a million!
Answered 04/27/2007 by: Trooper23
Orange Belt

Please log in to comment
0
Hi jmcfadyen,

Have you opeded that pagefileconfig.vbs, was hands down the scariest and largest VBS I’ve ever seen, but thanks.
Answered 04/27/2007 by: Trooper23
Orange Belt

Please log in to comment
0
lol most of it is rubbish I just rewrote it with my own requirements.
Answered 04/29/2007 by: jmcfadyen
Fifth Degree Black Belt

Please log in to comment
0
ORIGINAL: Trooper23

Hey JdotQ,

I created a AutoIt EXE that did the attrib and delete command, thanks for the idea. I added a RunOnce registry entry that did the job. Thanks a million!

Nice! Glad I could help! [:D]
Answered 05/01/2007 by: JdotQ
Senior Purple Belt

Please log in to comment
Answer this question or Comment on this question for clarity