Windows Core: Move Page File via PowerShell

Reading Time: < 1 minute

You have configured a Windows Core Server and the page file resides on disk C. You would like to move it to Disk P

Run the below commands one at a time. If copying and pasting the commands, you may need to reenter the ” if any of the commands error.
Also, if you receive Description = Invalid query when running command 2, please reboot your server and run all commands again.
wmic computersystem set AutomaticManagedPagefile=False

wmic pagefileset where name=”C:\\pagefile.sys” delete

wmic pagefileset create name=”P:\pagefile.sys”

4) Amend the InitialSize and MaximumSize figures as required. This command is based on a server including 4GB of memory. If your server includes 4GB of memory, it’s fine to use the below command:

wmic pagefileset where name=”P:\\pagefile.sys” set InitialSize=6144,MaximumSize=6144

5) Reboot the server

6) Run below command to confirm location of your page file
wmic pagefile list /format:list