VMware Cloud Community
Mike_Yazbeck
Enthusiast
Enthusiast

WMI Query Issue with "ExistingPageFiles" Key

Although this is technically not PowerCLI, the core code uses it to manipulate WMI further down the road.

Synopsis:

I am trying to set the pagefile on all servers from 2008 and above to system on the C: drive only. If I run the following code:

   $a = Get-WmiObject Win32_ComputerSystem -EnableAllPrivileges
   $a.AutomaticManagedPagefile = $True
   $a.Put()

The code works, and in server 2008 there is now a tickbox for "Automatically manage paging file size for all drives" whereas this feature wasnt available in Server 2003.

This is where my problem states, the following key is available in server 2008 and above:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\ExistingPageFiles

However I dont know how to query it via WBEMTEST. Does anyone know where it resides?

If you run the code above however, and you have 2 separate drives that are custom sized then it simply sets both drives to "system managed" which is greyed out and ticks "Automatically manage paging file size for all drives".

I cannot seem to find any material that will allow me to probe the ExistingPageFiles registry key directly.

Any help would be greatly appreciated Smiley Happy

0 Kudos
4 Replies
LucD
Leadership
Leadership

Can't you just do?

(Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management').ExistingPageFiles


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Mike_Yazbeck
Enthusiast
Enthusiast

The problem is, I need to change the details on 90 servers.

If you run a foreach loop, you cannot remotely authenticate using remote registry, but you can with Get-WMIObject and Set-WMIObject.

I really wanted to avoid having to use WMI at all because the registry is easier to target.

0 Kudos
LucD
Leadership
Leadership

Or run it with Invoke-VMScript


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Mike_Yazbeck
Enthusiast
Enthusiast

Thats a very good idea :smileygrin:

Thanks Smiley Happy

0 Kudos