⚡ PowerShell 5.1+
Get Processes Report
Queries Win32_Process via WMI and reports Processes in a formatted table, with an optional CSV export.
Get-ProcessReport.ps1
<#
.SYNOPSIS
Reports Processes on this computer via WMI (Win32_Process).
.DESCRIPTION
Queries Win32_Process and displays Name, ProcessId, WorkingSetSize, ThreadCount 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-ProcessReport.ps1
.EXAMPLE
.\Get-ProcessReport.ps1 -ExportPath C:\Reports\process.csv
#>
[CmdletBinding()]
param(
[string]$ExportPath
)
$items = Get-CimInstance -ClassName Win32_Process | Select-Object Name, ProcessId, WorkingSetSize, ThreadCount
if (-not $items) {
Write-Host "No Processes 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
}