VMware Cloud Community
socbizkaia
Contributor
Contributor
Jump to solution

obtain VIServer of VirtualMachine Object

Hello,

how could I get the VIServer object or string of the connection from which I manage a VirtualMachine object? I need the VIServer object/string because I need to create new tags in the specific server where the VM is connected to. In other words, I need to run "New-Tag "lalal" -Server myserver.com" and I have several servers and connections opened.

Thanks!

Christian

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try like this

Get-VM |

Select Name,@{N='vCenter';E={([System.Uri]$_.ExtensionData.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-VM |

Select Name,@{N='vCenter';E={([System.Uri]$_.ExtensionData.Client.ServiceUrl).Host}}


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

0 Kudos
socbizkaia
Contributor
Contributor
Jump to solution

Thanks this is exactly what I was looking for!

0 Kudos