2

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.

  • I think you have to turn off the automatic management first, wmic computersystem set AutomaticManagedPagefile=False – Brian Jul 29 '17 at 0:03
0

Try using the script below to disable the pagefile management, and then set the new values.

Set-CimInstance -Property @{AutomaticManagedPageFile = $False}

$PageFile = Get-CimInstance -ClassName Win32_PageFileSetting
$PageFile | Remove-CimInstance

New-CimInstance -ClassName Win32_PageFileSetting -Property  @{Name= "$("C"):\pagefile.sys"}
Get-CimInstance -ClassName Win32_PageFileSetting | Set-CimInstance -Property @{InitialSize = 4096; MaximumSize = 4096}

Source: https://richardjgreen.net/modifying-nano-server-pagefile/

  • I don't have the server up at this time but I'll give it a shot. – Persistent13 Aug 1 '17 at 3:09

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.