The "wmic computersystem set AutomaticManagedPageFile=FALSE" command causes the loss of existing pagefile settings on a Windows Vista, Windows Server 2008, Windows 7, or Windows Server 2008 R2-based computer

Symptoms

Pagefile settings are stored in the following registry entry on a computer that is running Windows Vista, Windows Server 2008, Windows 7, or Windows Server 2008 R2:
HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PagingFiles
If you run the following command, the REG_MULTI_SZ value of this registry entry is set to "C:\pagefile.sys 0 0":
wmic computersystem set AutomaticManagedPageFile=FALSE
This issue causes the loss of existing pagefile settings for operating systems that have the following pagefile settings:
  • The initial and maximum pagefile sizes are explicitly specified.
    For example:
    C:\pagefile.sys 4095 4095 
  • Multiple pagefiles are on multiple volumes.
    For example:
    C:\pagefile.sys 8200 8200
    D:\pagefile.sys 8200 8200
    E:\pagefile.sys 8200 8200
Note The problem also occurs if the AutomaticManagedPagefile property of the WMI Win32_ComputerSystem class is set to "FALSE" by program code by using the COM interface.

Workaround

Method 1
Confirm the current setting of the page file by running the following command:
wmic computersystem get AutomaticManagedPageFile
Also, avoid setting the value to "FALSE" if it is already set to "FALSE."

Method 2
Run VBScript code instead of the wmic command to disable the AutomaticManagedPageFile property. To do this, follow these steps:
  1. Start Notepad.
  2. Paste the following code into Notepad:
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

    For Each objCS in objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem")
    on Error Resume Next
    ' Wscript.Echo "AutomaiticManagedPagefile: " & objCS.AutomaticManagedPagefile
    If (objCS.AutomaticManagedPagefile) Then
    Wscript.Echo "Setting AutomaticManagedPagefile to False"
    objCS.AutomaticManagedPageFile=False
    objCS.Put_
    Else
    Wscript.Echo "AutomaticManagedPagefile was already False. Just leaving"
    End If
    ' Wscript.Echo "AutomaiticManagedPagefile: " & objCS.AutomaticManagedPagefile
    Next
  3. On the File menu, click Save as.
  4. Select a destination, type
    AutomaiticManagedPagefile.vbs in the File name box, and then click Save.
  5. Run the AutomaiticManagedPagefile.vbs script on your computer.

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

More Information

The WMI provider of the Win32_ComputerSystem class is implemented in CimWin32.dll. This .dll file changes the following registry value when the AutomaticManagedPageFile property of the WMI Win32_ComputerSystem class is changed:
HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PagingFiles
If the AutomaticManagedPageFile property is set to TRUE, the value is set to "?:\pagefile.sys." If the AutomaticManagedPageFile property is set to FALSE, the value is set to "c:\pagefile.sys 0 0." Therefore, any other page file settings are overwritten when this issue occurs.

For more information, click the following article number to view the article in the Microsoft Knowledge Base:

959516 Multiple pagefiles are created when you set the AutomaticManagedPagefile property of the Win32_ComputerSystem class to False on a computer that is running Windows Server 2008 or Windows Vista Service Pack 1

プロパティ

文書番号:974028 - 最終更新日: 2010/01/26 - リビジョン: 1

フィードバック