Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 219257

Re: Get-dvPgFreePort Function Issue

$
0
0

Thanks, LucD.  I am using this function to help with a vCenter migration in which the destination dvSwitch doesn't have any connected VMs.  You are correct in your statement that the portgroup in which I received the error doesn't have any VMs.  I was able to determine this by issuing the following commands from the function:

 

$pg = Get-VirtualPortGroup -Distributed -Name $PortGroup

Get-View $pg.ExtensionData.Vm(returns nothing)

 

It is interesting that most of the VMs worked and that a few didn't.  I'm not sure what information you need, but here is some screenshots of the dvSwitch:

 

2016-03-05_113713.png

 

Here is how I'm using the function when trying to add the VM NIC:

 

$vmPortKey = Get-dvPgFreePort -PortGroup "${NetworkName}" -Number 1

get-networkadapter -VM "${VM}" | Set-NetworkAdapter -DistributedSwitch $VDS -PortKey $vmPortKey -WakeOnLan:$true -StartConnected:$true -Connected:$true -Confirm:$false

 

... where "NetworkName" is equal to "10.29.0.0/16_VLAN2_SSH-Workstations" for one of the VMs that is failing.  Also keep in mind that we have might have multiple dvSwitches in the same environment.

 

I hope I didn't leave anything out, and that his information helps!  You have been a critical to my migration, and it is greatly appreciated!

 

 

Charles


Viewing all articles
Browse latest Browse all 219257

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>