Scripting Question

How to change virtual memory on systems with different RAM sizes via script ?

07/30/2019 998 views

I have Win10 ENT 1809 systems with 8GB of RAM and now 16GB of RAM.  How can I change the virtual memory via a script that reads the RAM amount and changes accordingly ? The WIM virtual memory is set for 8GB 12288/24576 and 16GB machines needs to be set at 24576/49152.  I just need a script I can run in a task sequence after image deployment.  HELP.

0 Comments   [ + ] Show comments


  • This content is currently hidden from public view.
    Reason: Removed by member request For more information, visit our FAQ's.

All Answers


open google and search "change page file command line"


look at result 3 https://social.technet.microsoft.com/Forums/windows/en-US/01b59794-f904-4983-9df3-5da8327f509d/how-to-change-page-file-size-and-location-from-command-line-during-setup?forum=w7itproinstall

To change the page file size from command line, enter the line below (adapt the location and size)wmic pagefileset where name="C:\\pagefile.sys" set InitialSize=2048,MaximumSize=2048After setting the pagefile yourself, you can check its settings with:
wmic pagefileset or wmic pagefileset list /format:listthen restart your computerregards,

I've used RegFromApp to "scan" changes in the registry by the AdvancedProperties program and I've found that it changes the "PagingFiles" key in the registry.So, I've executed the following:reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v PagingFiles /t REG_MULTI_SZ /d "d:\pagefile.sys 2048 2048" /restarted Windows, and voilà, the pagefile in c:\ is gone, and a new one is created in the D:\ drive.Easy.
Answered 07/30/2019 by: SMal.tmcc
Red Belt

  • Thank you SMal.tmcc . However, I need a line or 2 that will read the RAM size and adjust virtual memory accordingly.
    • do you have a Kace SMA?
      • Used to. Now on MDT.
      • ahh to bad kace would have made that easy. leaving work for vacation in 10 so I am sorry I cannot research further. that will require powershell or vbs to compare and accomplish.
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ