PowerTip: Use PowerShell 3.0 to Find an IP Address

PowerTip: Use PowerShell 3.0 to Find an IP Address

  • Comments 7
  • Likes

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

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • helpful

  • Hi All,

    I require a powershell script which will check the particular string value in txt file and if not present  that string will be appended otherwise not.Any help is much apprecaited

    many thanks

  • Is there any way to get all of the new comdlets provided in '08 and 2012 into my r2 and win 7 boxes.  I have downloaded powershell v3 and installed it but I still don't see these new cmdlet's when I search for them.  

  • How about Windows7? what could be the script?

  • @AballahSonDis If you have installed PowerShell 3 on, say perhaps, Windows 7, then many of the new cmdlets -- those based on CIM wrappers are not available because they are part of the Windows 8 operating system. To see all of your available cmdlets load all your modules GMO -List | IPMO and then use Get-Command to see the new commands.

    @Shraddha see this blog article blogs.technet.com/.../use-powershell-to-identify-your-real-network-adapter.aspx

  • Hi Scripting Guys!

    Why is it that "IPAddress" was not included as default property of the NetAdapter? Why do we have pipe to another cmdlet to get that basic piece of information?

  • Nice.