⚡ PowerShell 5.1+
Get Page File Usage Report
Queries Win32_PageFileUsage via WMI and reports Page File Usage in a formatted table, with an optional CSV export.
Get-PageFileUsageReport.ps1
<#
.SYNOPSIS
Reports Page File Usage on this computer via WMI (Win32_PageFileUsage).
.DESCRIPTION
Queries Win32_PageFileUsage and displays Name, AllocatedBaseSize, CurrentUsage, PeakUsage for each item found.
Use -ExportPath to also save the results to a CSV file.
.PARAMETER ExportPath
Optional path to a .csv file to write the results to.
.EXAMPLE
.\Get-PageFileUsageReport.ps1
.EXAMPLE
.\Get-PageFileUsageReport.ps1 -ExportPath C:\Reports\pagefileusage.csv
#>
[CmdletBinding()]
param(
[string]$ExportPath
)
$items = Get-CimInstance -ClassName Win32_PageFileUsage | Select-Object Name, AllocatedBaseSize, CurrentUsage, PeakUsage
if (-not $items) {
Write-Host "No Page File Usage found." -ForegroundColor Yellow
return
}
$items | Format-Table -AutoSize
if ($ExportPath) {
$items | Export-Csv -Path $ExportPath -NoTypeInformation -Encoding UTF8
Write-Host "`nExported to $ExportPath" -ForegroundColor Cyan
}