Hello @Alfred001,
I have put this together for you.
If you wanted to quickly get the Pagefile(s)
data for all drives, Copy & Paste
the following [ ALL at once ] into Notepad
and Save
it as a .bat
file. Then you can just run it. It will open a CMD Prompt
and output the information.
Code:
@echo off
echo. & echo ___ Pagefile(s) ___& echo.
PowerShell ^
Get-CimInstance -ClassName Win32_PageFileUsage ^| %% {"""{0,-1} {1:N0} MB""" -f ' Total CURRENT Paging Size for ALL Disks:', $_.AllocatedBaseSize; $SystemTotal +=$_.AllocatedBaseSize}
echo.
PowerShell ^
$CMD=Get-CimInstance -ClassName Win32_PageFileSetting ^| Sort-Object -Property {$_.Name}; ^
$Tot =($CMD ^| Measure-Object).Count.ToString('#,##0'); ^
$List=($CMD ^| Format-Table -AutoSize ^
@{L='Name' ;E={;if([string]::IsNullOrWhiteSpace($_.Name)) {'-'} else {$_.Name}}}, ^
@{L='Initial Size';E={;if([string]::IsNullOrWhiteSpace($_.InitialSize)) {'-'} else {[Math]::Round($_.InitialSize / 1, 0).ToString('#,##0 MB')}}}, ^
@{L='Maximum Size';E={;if([string]::IsNullOrWhiteSpace($_.MaximumSize)) {'-'} else {[Math]::Round($_.MaximumSize / 1, 0).ToString('#,##0 MB')}}} ^| ^
Out-String -Width 1000).Trim("""`r`n"""); ^
if ($List.Length) {Write-Host """`n___ Pagefile(s) - Settings [$Tot] - Sorted by [Name] ___`n`n `n`n$List"""} else {exit 1} >> %Temp%\A.txt
for /f "delims=" %%i in (%Temp%\A.txt) do echo. %%i
del %Temp%\A.txt
PowerShell ^
$Tot=((Get-CimInstance -ClassName Win32_PageFileSetting) ^| Measure-Object).Count; ^
if ($Tot -gt 0) {Write-Host """`n ___ Pagefile(s) - Locations [$Tot] - Sorted by [Name] ___`n"""} else {exit 1}
PowerShell ^
$PageFile=Get-CimInstance -ClassName Win32_PageFileSetting; ^
ForEach ($pag in $PageFile) { ^
if ($pag.InitialSize -eq 0) { ^
Write-Host '' $pag.Name "- Automatic Managed Pagefile: True [System Managed]" ^
} else { ^
Write-Host '' $pag.Name "- Automatic Managed Pagefile: False [Custom Managed]" ^
} ^
}
PowerShell ^
$CMD =Get-CimInstance -ClassName Win32_PageFileUsage ^| Sort-Object -Property {$_.Name}; ^
$Tot =($CMD ^| Measure-Object).Count.ToString('#,##0'); ^
$List=($CMD ^| Select ^
@{L=' Name' ;E={;if([string]::IsNullOrWhiteSpace($_.Name)) {'-'} else {$_.Name}}}, ^
@{L=' Install Date' ;E={;if([string]::IsNullOrWhiteSpace($_.InstallDate)) {'-'} else {$_.InstallDate}}}, ^
@{L=' Allocated Base Size';E={;if([string]::IsNullOrWhiteSpace($_.AllocatedBaseSize)) {'-'} else {[Math]::Round($_.AllocatedBaseSize / 1, 0).ToString('#,##0 MB')}}}, ^
@{L=' Current Usage' ;E={;if([string]::IsNullOrWhiteSpace($_.CurrentUsage)) {'-'} else {[Math]::Round($_.CurrentUsage / 1, 0).ToString('#,##0 MB')}}}, ^
@{L=' Peak Usage' ;E={;if([string]::IsNullOrWhiteSpace($_.PeakUsage)) {'-'} else {[Math]::Round($_.PeakUsage / 1, 0).ToString('#,##0 MB')}}}, ^
@{L=' Temporary Pagefile' ;E={;if([string]::IsNullOrWhiteSpace($_.TempPageFile)) {'-'} else {$_.TempPageFile}}}, ^
@{L=' CIM Class' ;E={;if([string]::IsNullOrWhiteSpace($_.CimClass)) {'-'} else {$_.CimClass}}}, ^
@{L=' Status' ;E={;if([string]::IsNullOrWhiteSpace($_.Status)) {'-'} else {$_.Status}}} ^| ^
Format-List ^| Out-String -Width 1000).Trim("""`r`n"""); ^
if ($List.Length) {Write-Host """`n ___ Pagefile(s) - Usage [$Tot] - Sorted by [Name] ___`n`n$List"""} else {exit 1}
echo. & echo ^>Press ANY key to EXIT . . . & pause >nul & Exit
The above is an extract from my PROJECT: Computer Report - Comprehensive
in my signature.
I hope this helps.