Tuesday, 29 April 2008

Server Core - Move that Swap/Page File - WMI Error Code = 0x80041017

UPDATED 2012-01-17: MPECS Inc. Blog: Server Core–How to Properly Move the Swap File

This one was a really tough find ...

From the Microsoft TechNet Server 2008 Core online documentation on managing Server Core we get (square brackets because Blogger can't seem to interpret greater than or less than symbols properly):

Disable paging file management: At a command prompt, type:

wmic computersystem where name="[computername]" set AutomaticManagedPagefile=False
So, in our Core command line we type on one line (ignore text wrapping):

wmic computersystem where name="MyCoreServerName" set AutomaticManagedPagefile=False
WMI tells us that the command was successful.

On to step 2:

Configure the paging file: At a command prompt, type:

wmic pagefileset where name=”[path/filename]” set InitialSize=[initialsize],MaximumSize=[maxsize]

Where:

path/filename is the path to and name of the paging file
initialsize is the starting size of the paging file in bytes.
maxsize is the maximum size of the page file in bytes.
Okay, no matter how we interpret the above command, we cannot get a success message from WMI.

The errors we were getting the following two errors consistently:

  • No Instances Available
  • Error Code = 0x80041017
    Description = Invalid query
    Facility = WMI
Any amount of searching either turned up a regurgitation of the TechNet article, or out of date instructions that did nothing to help us.

After a number of different searches using a number of different search engines, we finally stumbled on the following on the Server Core blog: Tips and Tricks Vol. 4:

  1. wmic computersystem where name=”[computername]” set AutomaticManagedPagefile=False
  2. wmic pagefileset where name=”C:\\pagefile.sys” set InitialSize=500,MaximumSize=1000
How refreshing. :) The second command worked for establishing an 8-16GB page file on the S: partition and it verifies after the reboot.

We are fortunate that we have blogs to turn to in this day and age. Here is a good example where the documentation for a product is not so good, but the product team's blog documentation is very good.

This is not the first time we have run into poor product documentation for a new Microsoft product. It probably will not be the last. This is truly unfortunate because we then need to waste a bunch of time searching out the answer to something that should be right in front of us in the first place. :(

UPDATE 2008-06-25: For clarification on the above: Assuming that we have created a partition with the S: label:
  1. wmic computersystem where name=”MyCoreServer” set AutomaticManagedPagefile=False
  2. wmic pagefileset where name=”S:\\pagefile.sys” set InitialSize=2500,MaximumSize=10240
The above commands will disable the system managed pagefile and create a new one using the sizes indicated on the S: partition. Note the lack of spaces between the Intial and Maximum size settings.

Also note, if the command continues to fail, reboot after disabling the automatic pagefile management and run the command again. We are finding that the command does not always run successfully after disabling the automatic management.

Philip Elder
MPECS Inc.
Microsoft Small Business Specialists

*All Mac on SBS posts are posted on our in-house iMac via the Safari Web browser.

14 comments:

Anonymous said...

Exactly what I was looking for after struggling with Code = 0x80041017 Error message.

Great work. Thanx

Dave A-W said...

Are those sizes bytes or MB?

Philip Elder Cluster MVP said...

Dave,

They are in MB. The last example was to set a 2.5GB (2500) to 10GB (10240) page file.

Philip

Anonymous said...

Hello.

I have followed your instructions and everything appreasrs to be as expected. Except :-

after a reboot if I rung the pagefile command (instead of pagefileset) the fagefile appears to still be on the c drive.

Andy ideas?

Thanks in advance

Andy

Philip Elder Cluster MVP said...

Andy,

When you do an attrib *.* on the swap file partition do you see the pagefile.sys there?

Philip

Anonymous said...

Hello.

Yes, there is a pagefile on the c drive and a pagefile on the z drive.

Andy

Philip Elder Cluster MVP said...

Andy,

attrib -h -s on the C:\pagefile.sys

Rename the file to pagefile.old.

If that works, then you can safely delete it as the OS is no longer using it.

Philip

Anonymous said...

Due to the 4,096 character limit I can only manage to post this. I'm using Server 2008 R2 x64Server Core.

http://blogs.dirteam.com/blogs/sanderberkouwer/Default.aspx?p=10

Changing page file location
Another management option is to move the page file to another partition (or volume). Moving a page file involves deleting an existing page file and making a new one somewhere else. I used the following set of commands to move the Page File from the C: drive to the D: drive on my test system.

diskpart.exe

DISKPART> select disk 0
DISKPART> select partition 1
DISKPART> shrink desired=2280
DISKPART> create partition primary
DISKPART> select partition 2
DISKPART> format fs=ntfs label="Swap"
DISKPART> assign letter=E
DISKPART> exit

wmic.exe pagefileset create name="E:\pagefile.sys"
wmic.exe pagefileset where name="E:\\pagefile.sys" set InitialSize=2048,MaximumSize=2048
wmic.exe pagefileset where name="C:\\pagefile.sys" delete

You can replace values to suit your situation. Your settings will take effect after a reboot of the system.

Philip Elder Cluster MVP said...

A,

Thank you for the update. That first command to create the file on the swap partition was definitely missing in our instructions here.

Philip

Unknown said...

Hi,

at least on Windows 2008 R2 x64 you have to add another command.

wmic.exe computersystem where name="WIN-WHAT-O-EVER" set AutomaticManagedPagefile=False
wmic.exe pagefileset create name="E:\pagefile.sys"
wmic.exe pagefileset where name="E:\\pagefile.sys" set InitialSize=2047,MaximumSize=4095
wmic.exe pagefileset where name="C:\\pagefile.sys" delete

Without the create command I just get the famous "No Instance(s)" error.

Cheers,
Christoph

Anonymous said...

Your first pagefileset command uses one backslash and the next two pagefilesets use two backslashes. Is this really correct?

Anonymous said...

Found an interesting gotcha

http://support.microsoft.com/kb/979386

Running Hyper-V and trying to move the pagefile to a SCSI attached VHD will not work as SCSI isn't initialized when windows tries to setup the pagefile.

Other than that... a great article

Philip Elder Cluster MVP said...

A.,

There is no gotcha that we know of.

We are talking about moving the swap file on the Hyper-V host which would normally be deployed using physical disks configured in RAID arrays.

Philip

Anonymous said...

This is what I ended up using:

wmic computersystem where name="%computername%" set AutomaticManagedPageFile=false
wmic pagefileset create name="P:\\pagefile.sys",InitialSize=3434,MaximumSize=3434
wmic pagefileset where name="C:\\pagefile.sys" delete