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