VMware Cloud Community
vmwarelicense12
Enthusiast
Enthusiast
Jump to solution

Get vm from port id

How do i from powercli get a vm from a port ID?

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

You mean something like this?

$portId = 1

Get-VDSwitch | Get-VDPort -Key $portId |

Select Switch,Portgroup,@{N='VM';E={$_.ConnectedEntity.Parent.Name}}


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

View solution in original post

0 Kudos
4 Replies
LucD
Leadership
Leadership
Jump to solution

You mean something like this?

$portId = 1

Get-VDSwitch | Get-VDPort -Key $portId |

Select Switch,Portgroup,@{N='VM';E={$_.ConnectedEntity.Parent.Name}}


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

0 Kudos
vmwarelicense12
Enthusiast
Enthusiast
Jump to solution

Not exactly. It does not return the name om the VM, witch I am interested in.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

It does for me.

portid.png

Are you sure you are not looking at a port Id that has no VM connected?


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

0 Kudos
vmwarelicense12
Enthusiast
Enthusiast
Jump to solution

Ohhh... you are right. All good.. thanks.

0 Kudos