⚡ PowerShell 5.1+

Get Network Adapter Configuration Report

Queries Win32_NetworkAdapterConfiguration via WMI and reports Network Adapter Configuration in a formatted table, with an optional CSV export.

By WindowsScripting.com · 1.1 KB
Get-NetworkAdapterConfigReport.ps1
<#
.SYNOPSIS
    Reports Network Adapter Configuration on this computer via WMI (Win32_NetworkAdapterConfiguration).

.DESCRIPTION
    Queries Win32_NetworkAdapterConfiguration and displays Description, IPAddress, DefaultIPGateway, DNSServerSearchOrder 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-NetworkAdapterConfigReport.ps1

.EXAMPLE
    .\Get-NetworkAdapterConfigReport.ps1 -ExportPath C:\Reports\networkadapterconfig.csv
#>

[CmdletBinding()]
param(
    [string]$ExportPath
)

$items = Get-CimInstance -ClassName Win32_NetworkAdapterConfiguration | Select-Object Description, IPAddress, DefaultIPGateway, DNSServerSearchOrder

if (-not $items) {
    Write-Host "No Network Adapter Configuration 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
}