PowerCLI

The Way To PowerCLI : Retrieve VMs IP Addresses

we back again after break , today my first post in 2018 wish to all of you happy new year full of joy and all you wishes become true

so today we will be talking about how to retrieve VMs IP Address

You can get the IP addresses for VMs from  the virtual machine guest property

retrieve IP Address for one VM

(Get-VM -Name test01).Guest.IPAddress

2018-01-03_8-36-41

for multi VMs

 
(Get-VM).Guest.IPAddress 

or we can use this formate to get IP Address

 Get-VM -Name test02 | Select Name , powerstate , @{N="IP Address";E={@($_.Guest.IPAddress)}} 

2018-01-03_8-58-17

or  use this will  give same result

Get-VM -name test02| Get-VMGuest | Format-Table VM ,IPAddress 

Retrieve IP Address for all VMs 

This is useful if you want to create a list of all your VMs with IP addresses and you can add more options like ‘Cluster , ESXI host , Datastore , powerstate … etc ‘

 
Get-VM | Select Name , powerstate , @{N="IP Address";E={@($_.Guest.IPAddress)}} 

2018-01-03_9-19-01

you can export to CSV

 
Get-VM | Select Name , powerstate , @{N="IP Address";E={@($_.Guest.IPAddress)}} | Export-CSV c:\vSaiyan.csv -NoTypeInformation  

or  use this will  give same result

Get-VM | Get-VMGuest | Format-Table VM ,IPAddress 

” The way to VMware PowerCLI ” Series Posts :

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s