PowerCLI

 View Only
  • 1.  Listing Virtual machines and their IP address information

    Posted Apr 06, 2010 03:16 PM

    I need to do an IP audit of all our machines ,and as mostly we run virtual machines, I really need help with a script which gives me the list of virtual machines names, and their IP address and also possibly the additional IP's as well. Can someone please assist.

    Also is there a script which can give the esx servers and their IP information as well.

    Thanks



  • 2.  RE: Listing Virtual machines and their IP address information

    Posted Apr 06, 2010 03:20 PM

    Have you tried the VI Client? You can export from there.

    You can get a list from the DHCP server.

    You can do a arp list (netstat -a) to give you a list of ALL the VM's.

    You can log into the switch and get the MAC address starting with 00:50:56 and the corresponding IP.

    Lots of ways you can do it..



  • 3.  RE: Listing Virtual machines and their IP address information

    Posted Apr 06, 2010 04:17 PM

    Provided you run the VMware Tools on your guests you can use

    Get-VM | Get-VMGuest | select VmName, IPAddress
    

    This is a "raw" display, if you have specific output requirements let me know.

    For the ESX IP information have a look at

    ____________

    Blog: LucD notes

    Twitter: lucd22



  • 4.  RE: Listing Virtual machines and their IP address information

    Posted Apr 06, 2010 04:21 PM

    will this include information on the additional Ip's for the Virtual Machines.



  • 5.  RE: Listing Virtual machines and their IP address information

    Posted Apr 06, 2010 05:26 PM
    Get-VM | Get-VMGuest | select VmName, @{N="IP Address(s)"; E={$_.IPAddress}}

    With a slight modification, this will return more than one IP Address in a single column. Luc's method would return it as an object readable in RAW format, not so much so when exporting.

    Chris Nakagaki (Zsoldier)