Last active
December 12, 2016 04:05
-
-
Save tonysangha/6e646cbb536fdd9faa861bc5f642c98b to your computer and use it in GitHub Desktop.
Get MAC & IP using PowerCLI
This file contains 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
$vms = get-vm | |
# Get VM Name based on a MAC | |
foreach ($vm in $vms){ | |
if(get-networkadapter $vm | where-object {$_.MacAddress -eq "MAC-ADDRESS"}) | |
{ | |
write-host $vm | |
} | |
} | |
# Get VM IP Address based on name | |
Get-VM | where-object {$_.name -eq "VM-NAME"} | Select Name, @{N="IP Address";E={@($_.guest.IPAddress[0])}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment