Skip to content

Script to Change the Page File in Windows 2008 Server Core


It is very common to install Windows 2008 Core mode forget the size that the paging file will stay.

Normally it will create a paging file with the same size of memory, which hosts with 128 GB will leave a server (which typically has 160 GB disks) with the OS disk almost full.

It’s simple to change the Page File by using the script below which you can copy to a cmd file and run.

wmic pagefile list /format:list
wmic computersystem where name=”%computername%” set AutomaticManagedPagefile=False
wmic pagefileset where name=”C:\\pagefile.sys” set InitialSize=16384,MaximumSize=16384
shutdown -r -t 0

Line-by-line explanation follows:

  1. Lists the current settings, only for the check line 4, note the line parameter Name
  2. Pause to cancel and modify the line 4 if necessary
  3. Deactivates the Auto mode (default) and manual leaves
  4. Changes the paging file to 16 GB, so you can use other size that may be deemed necessary
  5. Pause before the shutdown to check if there are error messages
  6. Restart the server immediately

From → Windows

  1. Hi,
    can you help me to move the page file to H drive and set the pagefile as 1.5 times Ram of the computer?

  2. Hi Eswar,

    You need set pagefile for drive C: to 0 and set drive H:
    I dont have a command or parameter to read physical memory to set automatically size.


  3. Luca permalink

    Sorry for who love command line..
    Run sysdm.cpl

Leave a Reply to Eswar Koneti Cancel reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

%d bloggers like this: