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:
- Lists the current settings, only for the check line 4, note the line parameter Name
- Pause to cancel and modify the line 4 if necessary
- Deactivates the Auto mode (default) and manual leaves
- Changes the paging file to 16 GB, so you can use other size that may be deemed necessary
- Pause before the shutdown to check if there are error messages
- Restart the server immediately