I'm scripting a check for pagefile status utilizing PowerShell. On Windows 2000/2003 machines a user can choose between 3 pagefile options via the windows virtual Memory dialog:
I can successfully determine which of these options are selected by doing a:
$PageFileInfo = Get-WmiObject Win32_PageFileSetting -ComputerName .
$PageFileInfo.MaximumSize
that is non-zero$PageFileInfo.MaximumSize
that is zero$PageFileInfo
My issue is that on a Windows 2008 server, there is a 4th option:
and unfortunately, in this instance $PageFileInfo
returns null
, just as if No Paging file was selected.
I've attempted utilizing the following, all which return null
on my test 2008 server when Automatically manage paging file size for all drives is selected:
Get-WmiObject Win32_PageFileSetting -ComputerName .
Get-WmiObject Win32_PageFile -ComputerName .
Get-WmiObject -Query 'SELECT * FROM meta_class WHERE __this ISA
"Win32_PageFileSetting"'
How can I determine when Automatically manage paging file size for all drives
is selected? am I going about this in a sane manner?
Any advice would be appreciated.
Automatically managed page file settings are reached via Win32_ComputerSystem
class. The Win32_PageFileUsage
class has interesting data as well. A blog article has more information and a neat example.