Change the Page in Command Line

Have you ever wondered what happens when you format a server (or any Windows system) with a small bootable drive, and a large secondary drive?  Why would you?  It shouldn’t matter, right?

Recently a client of mine discovered different, when he formatted a server and then discovered that the Paging File was placed on the D drive, because it had more room.  If you try to use diskpart to clean a drive that holds the Paging File, it will fail.  Oops.

So, in Server with a GUI (or Desktop Experience, or whatever you want to call it) it is easy to open the Virtual Memory tab under Advanced System Properties and change the size, change where it sits, and so on.


Great… but what if we want to modify these settings in Server Core?  Or frankly, what if you have hundreds (or thousands) of systems that you want to configure?  The answer is, as usual, Command Line (PowerShell can do it too I am sure… I haven’t looked).

WMIC.exe is a command line tool that was developed to allow administrators to manage the Windows Management Instrumentation (WMI) from the command line (CLI).  It does myriad things, but for our purposes, we are going to use it to modify the Page File.

Step 1: See what you got!

From a command prompt, run the following command:

wmic.exe pagefile list /format:list

This will let you know where your page file is, and its usage.  The screenshot below shows that my Microsoft Surface Pro 4 has a page file of 2432 MB.  For a 16 GB laptop, that might be a little insufficient.


Step 1: Modify what you got!

Okay, it is fine for me that it is on the C drive, but I wish it was larger… and I no longer want it to be Automatically Managed. So:

wmic computersystem where name=”%computername%” set AutomaticManagedPagefile=False

The first step was to remove the automatic management.  That’s done.

Next, I want to  set my page file to have a 4 GB minimum and an 8 GB maximum.  Let’s do that:

wmic pagefileset where name=”C:\\pagefile.sys” set InitialSize=4096,MaximumSize=8192

Great, that is done.  Note, if my client wanted to change the location of the paging file, he would have changed it there.  If I had wanted to place it on the D drive, I would have done the following:

wmic pagefileset where name=”D:\\pagefile.sys” set InitialSize=4096,MaximumSize=8192

So there it is…  I ran these commands on my Surface Pro 4, and I should now have my 4-8 GB page file, right?


Wrong.  Anyone care to guess what is missing?  When do page files change?  Yes, a reboot is required.

I rebooted my system, and here’s what I got:


Success!  I achieved my goals… and with a bit of research, so will you.

Thanks to Microsoft MVP and fellow MCT Marcelo Sincic for reminding me the proper syntax!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s