Plz help
I am facing a following issues
Get-VM -server IP Address |select-object VMHost | Foreach-object{ write-output $_.VMHost}
print the entire VM infor instead of just VMHost
PowerState : PoweredOn
Version : v8
Description :
Notes :
Guest : SUSE LINUX 11.2 64 bit:
NumCpu : 1
MemoryMB : 2048
MemoryGB : 2
HardDisks : {Hard disk 1}
NetworkAdapters : {Network adapter 1, Network adapter 2}
UsbDevices : {}
CDDrives : {CD/DVD drive 1}
FloppyDrives : {Floppy drive 1}
Host :
HostId :
VMHostId :
VMHost :
VApp :
FolderId : Folder-group-v9
Folder : Discovered virtual machine
ResourcePoolId : ResourcePool-resgroup-8
ResourcePool : Resources
PersistentId :
UsedSpaceGB :
ProvisionedSpaceGB :
DatastoreIdList : {Datastore-datastore-123}
HARestartPriority : ClusterRestartPriority
HAIsolationResponse : AsSpecifiedByCluster
DrsAutomationLevel : AsSpecifiedByCluster
VMSwapfilePolicy : Inherit
VMResourceConfiguration : CpuShares:Normal/1000 MemShares:Normal/40960
Name : t
CustomFields : {}
ExtensionData : VMware.Vim.VirtualMachine
Id :
Uid :
Try like this
Get-VM -server IP Address | Select Name,@{N="Host";E={$_.Host.Name}}
The Select uses a calculated property to just return the name of the host to which the VM belongs
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Its still not working..
Is $_.Host.Name is correct ? or should I try $_.VMHost instead ?
I would try with $_.VMHost.
According to the documentation, .Host.Name is deprecated as of PowerCLI 5.0.
What is the error your getting?
have you tried:
Get-VM -Server IP Address | select Name , Host