Update: I never found a way to move the pagefile and with Microsoft's pivot to make Nano container only I doubt there will ever be a way to do this.
I am trying to move the pagefile on a Windows Server Nano install. The page file is located at E:\ and I am attempting to move it to C:\.
So far I have tried the CIM method (WMI cmdlets do not work with Nano) to move the pagefile, I ran Get-CimInstance -ClassName Win32_PageFileSetting | Set-CimInstance -Property @{Name='C:\pagefile.sys'; InitialSize = 0; MaximumSize = 2048}
with no errors however I'm pretty sure nothing is actually being changed and the pagefile did not move on reboot and still resides on E:\.
I then tried the wmic commands: wmic pagefileset create name="C:\pagefile.sys"
, worked with out issue. Then I tried wmic pagefileset where name="C:\\pagefile.sys" set InitialSize=2048,MaximumSize=2048
, it failed with the error Invalid format. Hint: <assignlist> = <propertyname>=<propertyvalue> [, <assignlist>].
I am able to see the newly created pagefile with wmic pagefileset get
and after reboot the pagefile still resides on the E:\ volume.
Each time I reboot the server I check that I can still see the pagefile present on E:\ and that the registry still shows the pagefile set for E:\. I am also unable to format or delete the E:\ volume as one would expect when the pagefile resides on it.
Try using the script below to disable the pagefile management, and then set the new values.
Source: https://richardjgreen.net/modifying-nano-server-pagefile/