Configure Virtual Memory by Windows command

This post shows how to configure Virtual Memory by Windows command.

By default, Virtual Memory size is managed automatically by operating system.
Configure the following settings as an example.

  • C: Drive
  • Custom size
  • Initial size 24,576 MB
  • Maximum size 24,576 MB

I have checked the procedure in this post on Windows Server 2016 and 2019.

Command

Run the following commands in Administrator’s Command Prompt.

(1) Run the following command to disable automatic management.

wmic computersystem set AutomaticManagedPagefile=False

It shows the following.

Property(s) update successful.

(2) Run the following command to confirm the modification.

wmic computersystem get AutomaticManagedPagefile

If it shows the following, automatic management is disabled.

AutomaticManagedPagefile
FALSE

(3) Run the following command to delete an existing pagefile.

wmic pagefileset DELETE

It shows the following.

Instance deletion successful.

(4) Run the following command to create a pagefile as C:\pagefile.sys

wmic pagefileset CREATE name="C:\pagefile.sys"

It shows the following.

Instance creation successful.

(5) Run the following command to configure the size of C:\pagefile.sys

wmic pagefileset where name="C:\\pagefile.sys" set InitialSize=24576,MaximumSize=24576

It shows the following.

Property(s) update successful.

(6) Run the following command to confirm the configuration.

wmic pagefileset where name="C:\\pagefile.sys" get

It shows the following.

Caption           Description          InitialSize  MaximumSize  Name
C\ 'pagefile.sys' 'pagefile.sys' @ C:\ 24576        24576        C:\pagefile.sys

(7) Reboot the operating system.

That’s about it.