hi
I tried:
Get-VM | Select Name, @{N="IP Address";E={@($_.guest.IPAddress[0])}}
and all other programs given below but none seems to be working, probably because Guest field is empty for my VM output.
I have to take these files and further I can export them to csv. Exporting to CSV, I know how it's done but all these vm files I am getting only name but No IP Address.
Sample Output or Get-Vm | Format-List in Powershell ISE
Name : VM_5360
PowerState : PoweredOn
Notes :
Guest :
NumCpu : 1
CoresPerSocket : 1
MemoryMB : 4096
MemoryGB : 4
VMHostId :
VMHost :
VApp :
FolderId :
Folder :
ResourcePoolId :
ResourcePool :
HARestartPriority : ClusterRestartPriority
HAIsolationResponse : AsSpecifiedByCluster
DrsAutomationLevel : AsSpecifiedByCluster
VMSwapfilePolicy :
VMResourceConfiguration : CpuShares:Normal/1000 MemShares:Normal/40960
Version :
PersistentId :
GuestId :
UsedSpaceGB :
ProvisionedSpaceGB :
DatastoreIdList :
ExtensionData : VMware.Vim.VirtualMachine
CustomFields : {}
Id : VirtualMachine-vm-1893
Uid : /VIServer=vsphere.local\administrator@100.100.10.97:443/VirtualMachine=VirtualMachine-vm-1893/
Powershell Version:
PS C:\Users\Administrator> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.20348.1366
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.20348.1366
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
And PowerCLI version:
PS C:\Users\Administrator> gET-pOWERclivERSION
WARNING: The cmdlet "Get-PowerCLIVersion" is deprecated. Please use the 'Get-Module' cmdlet instead.
PowerCLI Version
----------------
VMware PowerCLI 10.0.0 build 7895300
---------------
Component Versions
---------------
VMware Cis Core PowerCLI Component PowerCLI Component 10.0 build 7893915
VMware VimAutomation VICore Commands PowerCLI Component PowerCLI Component 10.0 build 7893909
PS C:\Users\Administrator> $Global:DefaultVIServers | select Name, Version, Build
Name Version Build
---- ------- -----
100.100.10.97 8.0.1 21201873
ESXi Being Used on which VM are hosted: 7.0.3 (1e)