vmwarelicense12
Enthusiast
Enthusiast

Get vm from port id

Jump to solution

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

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership

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

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
vmwarelicense12
Enthusiast
Enthusiast

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

0 Kudos
LucD
Leadership
Leadership

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

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

0 Kudos