Get IP Address for different Adpater

Posted kivin

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Get IP Address for different Adpater相关的知识,希望对你有一定的参考价值。

 1 CLS
 2 $NetworkAdapters = Get-WmiObject -Class win32_networkadapter | ?$_.PhysicalAdapter -eqTrue‘ |select NetConnectionID 
 3 foreach($NetworkAdapter in $NetworkAdapters)
 4 
 5  $CurrentAdapter = ($NetworkAdapter |select  NetConnectionID).NetConnectionID
 6  $Result = CMD /C netsh interface ip show config name=$CurrentAdapter
 7  $IPInfos = ($Result|out-string)-split ([Environment]::NewLine)
 8  $DisconnectStatus = $true
 9  foreach($IPInfo in $IPInfos)
10  
11     
12     if($IPInfo -like ‘*IP Address*‘)
13     
14       $DisconnectStatus = $false
15       $CurrentIPv4 = $IPInfo
16       $DeviceIP = ($CurrentIPv4 -replace(‘IP Address:‘,‘‘)).Trim()
17       #$DeviceIP
18       Write-Host "Device: $CurrentAdapter /IP Address: $DeviceIP" -ForegroundColor Blue
19     
20  
21  if($DisconnectStatus)
22  
23    Write-Host "Device: $CurrentAdapter /Status: Disconnected " -ForegroundColor Blue
24  
25 

 

以上是关于Get IP Address for different Adpater的主要内容,如果未能解决你的问题,请参考以下文章

the ECDSA host key for ‘pc2‘ differs from the key for the IP address ‘192.168.144.250‘

"cni0" already has an IP address different from 问题解决

小错误Device eth2 has different MAC address than expected, ignoring.

无法使用 http://<ip-address> 连接到 phpmyadmin:port get 403 disabled

MySql连接错误:Can't get hostname for your address

Get the client's IP address in socket.io