Ok, so this is a bit of a wierd one.
During our automated build of Windows Server 2008, one of the options we
would like to set is the size of the Page File. Because we have servers with
lots of RAM and often not large system drives we like to set them manually,
this also helps avoid page file fragmentation.
In Server 2008, before you can set the page file manually, you need to
disable the automatic management of the page file using the
win32_ComputerSystem.AutomaticManagedPagefile property.
When I set this property to false using either a PowerShell window or WMIC
from the command-line it works nicely. However, when I try to set this
property using VBScript it fails to save the property. I have used the
following script:
***START SCRIPT***
Set objWMIService = GetObject("winmgmts:{impersonationlevel=impersonate,
(CreatePageFile)}!root\cimv2")
For Each objCompSys In objWMIService.ExecQuery("SELECT * FROM
Win32_ComputerSystem")
objCompSys.AutomaticManagedPagefile = False
WScript.Echo objCompSys.AutomaticManagedPagefile
Next
***END SCRIPT***
The script runs without errors AND outputs '0' to show that the setting has
been changed. However, when I then re-run the script without setting the
property, it outputs '-1' to show the setting is 'True'. I'm not aware of
normally needing to make any kind of 'update' to WMI, it normally updates as
you change a property, is there something that I'm doing wrong here?
I've ruled out (I think) any kind of permissions issues by including the
.Rename method in the script which successfully renamed the machine so I know
the interface works.
Any help would be appreciated
Regards
Brendan