VMware Cloud Community
wjlorenzolmco
Contributor
Contributor
Jump to solution

Find vCenter from Host

I have an odd problem I have yet to find a solution for. I am connecting to 14 vCenter servers/750+ hosts each as part of a larger script (at times) using -AllLinked. The issue I am having is some settings we look at are based on an XML file that defines the vCenter but with -AllLinked that breaks down. I am thinking I may need to add another attribute to define a pointer but was more curious if there is a Get-View out there that shows the vCenter the host is connected to? I have been looking but so far no luck.

Thanks in advance!

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try like this

Get-View -ViewType HostSystem -Property Name |

Select Name,

@{N='vCenter';E={([uri]$_.Client.ServiceUrl).Host}}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

Try like this

Get-View -ViewType HostSystem -Property Name |

Select Name,

@{N='vCenter';E={([uri]$_.Client.ServiceUrl).Host}}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
wjlorenzolmco
Contributor
Contributor
Jump to solution

I knew it had to be in there!! Much better to add an if then a new script to add a few thousand lines of xml...

0 Kudos