Showing posts with label scripting. Show all posts
Showing posts with label scripting. Show all posts

Monday, 19 September 2016

Get IP address Powershell Script


Below are the script for getting Ipaddress with Powershell

Method 1:

Get-WmiObject -query "select * from Win32_NetworkAdapterConfiguration where IPEnabled = $true" | %{$_.IPaddress -notmatch 'fe80'}


Method 2:

$a = Get-WmiObject -query "select * from Win32_NetworkAdapterConfiguration where IPEnabled = $true" |
  Select-Object -Expand IPAddress |
  Where-Object { ([Net.IPAddress]$_).AddressFamily -eq "InterNetwork" }


When i Call $a I get Ipaddress results...