Freigeben über


Windows PowerShell Script: List Network Adapter Configuration Properties

In this blog post, Brian Posey highlighted Windows PowerShell as an essential Windows networking skill going forward. In a new series of blog posts, we will highlight existing networking-based Windows PowerShell scripts in the Script Center Repository on TechNet and show how they can be used for basic or advanced networking capabilities, either at the Windows PowerShell command prompt or within your own custom scripts.

 

List Network Adapter Configuration Properties (https://gallery.technet.microsoft.com/scriptcenter/32b0cccd-aaf8-42b5-8abd-40b8438cfff4)

This Windows PowerShell script accesses the attributes of the Win32_NetworkAdapterConfiguration WMI object and then displays them individually with a series of Write-Host statements.

You can test this script by copying the code into a text editor (click Copy Code on the script page, then paste it), saving it as a .PS1 file, then executing the script by specifying its path and .ps1 file name (example: PS C:\users\default> c:\users\joedavies\netadapt.ps1).

For those of you honing your Windows PowerShell programming skills, notice how this script loads the $objWin32NAC object with the information in the Win32_NetworkAdapterConfiguration WMI object and then uses a foreach statement to display each attribute, identified with a "." and the name of the attribute (for example, .DefaultIPGateway).

Enjoy!

 

Joe Davies
Principal Writer
Windows Server Information Experience