December 7th, 2012

PowerTip: Use PowerShell 3.0 to Find an IP Address

Doctor Scripto
Scripter

Summary: Using Windows PowerShell 3.0 on Windows 8 or Windows Server 2012 to display the IP address.

Hey, Scripting Guy! Question How can I use Windows PowerShell 3.0 on Windows 8 or Windows Server 2012 to display IP address configurations?

Hey, Scripting Guy! Answer Use the Get-NetAdapter cmdlet and filter for net adapters that have a status of up. Pipe the results to the Get-NetIPAddress cmdlet. To produce a nice output, send the results to the Format-Tablecmdlet, as shown here.

Get-NetAdapter | ? status -eq ‘up’ | Get-NetIPAddress -ea 0 | ft ipaddress, interfacealias, prefixorigin -a

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.

Feedback