trying to get vmhost info and management IP plus vcenter but this is not working
New-VIProperty -Name vCenterServer -ObjectType VMHost -Value {$Args[0].Uid.Split(“:”)[0].Split(“@”)[1]} -Force | Out-Null
get-vmhost | get-vmhostnetworkadapter | ?{$_.name -eq "vmk0" } | select VMhost, name, IP, vCenterServer
vCenterServer is blank
any idea?
The ObjectType parameter should be HostVirtualNic
New-VIProperty -Name vCenterServer -ObjectType HostVirtualNic -Value {
$Args[0].Uid.Split(“:”)[0].Split(“@”)[1]
} -Force | Out-Null
Get-VMHost | Get-VMHostNetworkAdapter |
Where-Object{$_.name -eq "vmk0" } |
select VMhost, name, IP, vCenterServer
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The ObjectType parameter should be HostVirtualNic
New-VIProperty -Name vCenterServer -ObjectType HostVirtualNic -Value {
$Args[0].Uid.Split(“:”)[0].Split(“@”)[1]
} -Force | Out-Null
Get-VMHost | Get-VMHostNetworkAdapter |
Where-Object{$_.name -eq "vmk0" } |
select VMhost, name, IP, vCenterServer
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks Luc,
how come this does not work?
New-VIProperty -Name vCenterServer -ObjectType VMHost -Value {$Args[0].Uid.Split(“:”)[0].Split(“@”)[1]} -Force | Out-Null
get-vmhost | select name, @{n="ip";e={$_.extensiondata.summary.managementserverIp}}, vCenterServer
@tdubb123, Lucd was right, you were asking the VMhost network adapter information, and not the VMhost information. That is why the vCenterServer Property stayed empty.
As to your second question, that works fine on my end. The code seems alright to me.
I dont know why under the IP and vCenterServer colums is showing the same IP
NM, I got confused with managementServerIP as the vmkernel IP (vmk0)
Thanks again