Jump to content

Recommended Posts

Posted

Is it possible to set the PageFile size during install? In XP x64, I used PageFileConfig.vbs to set it out of GUIRunOnce. W7 does not have a PageFileConfig.vbs file and I cannot find an equivalent. The AutoUnattend.xml does offer a Size and Path for Windows PE. Thanks, John.


Posted

This script seems to work fine on my Win7 VMs - it ended up being a bit more complex than I would have liked, but it needed to handle scenarios where WMI didn't work or no paging file existed on the system.

Posted

This script seems to work fine on my Win7 VMs - it ended up being a bit more complex than I would have liked, but it needed to handle scenarios where WMI didn't work or no paging file existed on the system.

cluberti, thanks much! I will give it a try on my next install. Thanks, John.

Posted (edited)

cluberti, I really hate to ask questions since I am clearly not qualified to use your script - I am not knowledgeable enough. I have run it on my VM (VMware Player running W7 Ultimate x64, host XP x64). I always get "No paging file found." I do have a System managed paging file, currently 1024 MB. After some looking and research, it seems to me that the following code is returning nothing. Should this work on 64 bit machines?

Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PageFileSetting",,48)

Thanks much, John.

Edited by johnhc
Posted

cluberti, I really hate to ask questions since I am clearly not qualified to use your script - I am not knowledgeable enough. I have run it on my VM (VMware Player running W7 Ultimate x64, host XP x64). I always get "No paging file found." I do have a System managed paging file, currently 1024 MB. After some looking and research, it seems to me that the following code is returning nothing. Should this work on 64 bit machines?

Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PageFileSetting",,48)

Thanks much, John.

I designed it on a Win7 x64 box, so it worked fine on x64. However, it appears that having a system-managed paging file causes it to blow up, because that SELECT statement for Win32_PageFileSetting will return 0 if you have a system-configured paging file (which I wasn't checking for). You can see that there is a ? in this value if that is the case:

Key:   HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management
Value: PagingFiles
Type: REG_MULTI_SZ

Win32_PageFileUsage will return data, but this can't be used to configure it - I'll have to tweak my script a bit - you can still set a paging file with it currently, though - it'll still work if you enter data and reboot.

Posted

I designed it on a Win7 x64 box, so it worked fine on x64. However, it appears that having a system-managed paging file causes it to blow up, because that SELECT statement for Win32_PageFileSetting will return 0 if you have a system-configured paging file (which I wasn't checking for). You can see that there is a ? in this value if that is the case:

Key:   HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management
Value: PagingFiles
Type: REG_MULTI_SZ

Win32_PageFileUsage will return data, but this can't be used to configure it - I'll have to tweak my script a bit - you can still set a paging file with it currently, though - it'll still work if you enter data and reboot.

Thanks cluberti. I looked at the key you pointed to and the value is ?:\pagefile.sys. Thanks, John.

Posted

I designed it on a Win7 x64 box, so it worked fine on x64. However, it appears that having a system-managed paging file causes it to blow up, because that SELECT statement for Win32_PageFileSetting will return 0 if you have a system-configured paging file (which I wasn't checking for). You can see that there is a ? in this value if that is the case:

Key:   HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management
Value: PagingFiles
Type: REG_MULTI_SZ

Win32_PageFileUsage will return data, but this can't be used to configure it - I'll have to tweak my script a bit - you can still set a paging file with it currently, though - it'll still work if you enter data and reboot.

Thanks cluberti. I looked at the key you pointed to and the value is ?:\pagefile.sys. Thanks, John.

EDIT: Just tried it and it does work. Now the Registry value is set to "C:\pagefile.sys 512 512" and Properties shows it is no longer System-Managed.

Posted

Yup, seems to throw it off. I've updated and tested the script, and it'll handle a system-managed paging file now (although after you delete the file and set it back to system-managed, it'll always find the paging file as 0 size with 0 used (and this is incorrect), because the registry reflects this as 0 0. It seems to only work the first time properly detecting file size and usage... it doesn't break the script, just worth noting - I saw it and thought it was pretty funny :). One thing to note, it does NOT delete the paging file itself if you delete it with the script - it's locked, and you can't delete the file (usually pagefile.sys on C:) until after the reboot. Just FYI - it sets the paging file to 0, but doesn't actually delete the file itself; you must do that manually.

Posted

Yup, seems to throw it off. I've updated and tested the script, and it'll handle a system-managed paging file now (although after you delete the file and set it back to system-managed, it'll always find the paging file as 0 size with 0 used (and this is incorrect), because the registry reflects this as 0 0. It seems to only work the first time properly detecting file size and usage... it doesn't break the script, just worth noting - I saw it and thought it was pretty funny :). One thing to note, it does NOT delete the paging file itself if you delete it with the script - it's locked, and you can't delete the file (usually pagefile.sys on C:) until after the reboot. Just FYI - it sets the paging file to 0, but doesn't actually delete the file itself; you must do that manually.

cluberti, thanks again. Since I am only settings my pagefile size during install, is it enough simply to set the Registry value to "C:\pagefile.sys 1024 1024" (desired size)? I tried it on my VM and it seems to work fine. Thanks, John.

Posted

Yeah, setting the registry does the same thing. If you know you're always going to do it the same way, you can just write a reg_multi_sz string into it in that format and it'll pick it up on reboot. I prefer using scripts and user input to do things like that only because I tend to re-use all of my one-off scripts in many places, and it's easier to use an HTA or a VBS to handle it.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...