标签:write ddr stat spl result cmd nta config etc
1 CLS 2 $NetworkAdapters = Get-WmiObject -Class win32_networkadapter | ?{$_.PhysicalAdapter -eq ‘True‘} |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
标签:write ddr stat spl result cmd nta config etc
原文地址:https://www.cnblogs.com/kivin/p/10958850.html