VMware find duplicate IP address for server / vm vCenter VSphere

Script will use POWERCLI to run on your vmware environment *Tested in 5.1 Vsphere

1. download powerCLI *powershell for vmware  – https://my.vmware.com/web/vmware/details?downloadGroup=VSP510-PCLI-510&productId=285 

2. create script findIP.ps1

3. Copy and paste code into file NOTE:(make sure that the line $results= Get-View -Viewtype ………TO……..$strMacToFind)}} is on one line! not multi lines)

#Author  http://brilliantlyeasy.com/
#format of mac address argument in quotes “08:00:69:02:01:FC”
#use the mac of a network setting you know has the correct setting that has a conflict
#to run
# ./findIP.ps1 “08:00:69:02:01:FC”

#connet to vmware
$vCenterSv = ‘YOUR VCENTER SERVER’
$pass = Read-Host “Please enter Administrator password of VMWARE ENV”
$ConnectVcenter= Connect-VIServer -Server $vCenterSv -User administrator -Password $pass

$strMacToFind= $args[0]
$results= Get-View -Viewtype VirtualMachine -Property Name, Config.Hardware.Device | ?{$_.Config.Hardware.Device | ?{($_ -is [VMware.Vim.VirtualEthernetCard]) -and ($_.MacAddress -eq $strMacToFind)}}
write-host $results.name


#format of mac address argument in quotes "08:00:69:02:01:FC"
#use the mac of a network setting you know has the correct setting that has a conflict
#to run
# ./findIP.ps1 "08:00:69:02:01:FC"

#connet to vmware
$vCenterSv = 'YOUR VCENTER SERVER'
$pass = Read-Host "Please enter Administrator password of VMWARE ENV"
$ConnectVcenter= Connect-VIServer -Server $vCenterSv -User administrator -Password $pass

$strMacToFind= $args[0]
$results= Get-View -Viewtype VirtualMachine -Property Name, Config.Hardware.Device | ?{$_.Config.Hardware.Device | ?{($_ -is [VMware.Vim.VirtualEthernetCard]) -and ($_.MacAddress -eq $strMacToFind)}}
write-host $results.name

Find your MAC  Vmware:

Right Click on Vm –> Edit Settings –> Hardware –> Network Adapter 1 — Mac address

 

vmMac

At this point you have all you need — open PowerCLI – cd to where the script is located

RUN the script!

./findIP.ps1  “00:50:56:8d:6b:ab”

*Image below has full code of script

VMware Find Duplicate IP

share with friends

Share to Google Buzz
Share to Google Plus
Share to LiveJournal
Share to Odnoklassniki
No comments yet.

Leave a Reply