Hi All,
Is it possible using Powershell to list the IP address of my Webserver VM which has got multiple IP address ?
Thanks in advance.
Hey this is a very ruff example but should give you what you need to get the information.
Replace servername with your servers name and replace network card brand with your cards brand or you can leave off the where statement. The where statement just weeds out some of the junk.
Someone requested something quite similiar recently. I do not remember the thread but I have a copy of the script. I have just removed the stuff you don't need.
This script was created by LucD, so I am not taking credit for it.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$IPaddresses = @()
foreach($vm in Get-VM){
$vm.Guest.Nics | %{
$row = "" | Select Name, IP, MAC
$row.Name = $vm.Name
$row.IP = [String]::Join(',',$_.IPAddress)
$row.MAC = $_.MacAddress
$IPaddresses += $row
}
}
$IPaddresses
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you only want one VM you could change "($vm in Get-VM)" to "($vm in Get-VM webserver)"
Otherwise you could easily convert this to a oneliner as it doesn't seem like you are looking for a report.
This of course depends on VMware Tools.