Tuesday, February 13, 2024

#104: Get all the network cards installed in system using PowerShell

Below is small snippet that gives you info about all the network cards installed on your system. 


# Get all network adapters
$networkAdapters = Get-NetAdapter

# Output information about each network adapter
foreach ($adapter in $networkAdapters) {
    Write-Output "Name: $($adapter.Name)"
    Write-Output "Description: $($adapter.Description)"
    Write-Output "Interface Index: $($adapter.InterfaceIndex)"
    Write-Output "MAC Address: $($adapter.MacAddress)"
    Write-Output "Status: $($adapter.Status)"
    Write-Output "-----------------------------"
}

As you know, $adapter used above can be used to get more and more details you want. 

Hope this was quick and easy. 

Thanks!

No comments:

Post a Comment

#112: How to handle xml document in Powershell?

 In PowerShell, you can handle XML data using various cmdlets and methods provided by the .NET Framework. Here's a basic guide on how to...