Created
November 5, 2013 12:43
-
-
Save alexsaezm/7318482 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function GetStuff { | |
| $TargetMac = "MAC GOES HERE" | |
| $NetworkAdapters = gwmi Win32_NetworkAdapter | |
| foreach ($NetworkAdapter in $NetworkAdapters) { | |
| if($NetworkAdapter.MACAddress -eq $TargetMac -and $NetworkAdapter.ServiceName -eq "e1kexpress") { | |
| write-host "MACAddress:" $NetworkAdapter.MACAddress | |
| $DeviceID = $NetworkAdapter.DeviceID | |
| ConfigMe($DeviceID) | |
| } | |
| } | |
| } | |
| function ConfigMe([string]$DeviceID) { | |
| write-host $DeviceID | |
| $NetworkAdapterConfigurations = Get-WmiObject Win32_NetworkAdapterConfiguration | |
| foreach ($NetworkAdapterConfiguration in $NetworkAdapterConfigurations) { | |
| if ($NetworkAdapterConfiguration.Index -eq $DeviceID) { | |
| write-host $NetworkAdapterConfiguration.IPAddress | |
| } | |
| } | |
| } | |
| GetStuff |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment