<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: rename portgroup in VMware PowerCLI Discussions</title>
    <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/rename-portgroup/m-p/2065084#M67145</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No, use the first method.&lt;/P&gt;&lt;P&gt;The 2nd method is the SDK based and was used when previous builds of PowerCLI didn't have the feature yet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;____________&lt;/P&gt;&lt;P&gt;Blog: &lt;A href="http://lucd.info"&gt;LucD notes&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Twitter: &lt;A href="http://twitter.com/lucd22"&gt;lucd22&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 Aug 2010 17:10:47 GMT</pubDate>
    <dc:creator>LucD</dc:creator>
    <dc:date>2010-08-13T17:10:47Z</dc:date>
    <item>
      <title>rename portgroup</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/rename-portgroup/m-p/2065079#M67140</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have seen some scripts that do that here, but they all (or i got it wrong) disconnect the VM's&lt;/P&gt;&lt;P&gt;Is there a way to rename the portgroup , and automatically change all the VM's networks according to the new name?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Feb 2010 17:17:43 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/rename-portgroup/m-p/2065079#M67140</guid>
      <dc:creator>roneng</dc:creator>
      <dc:date>2010-02-11T17:17:43Z</dc:date>
    </item>
    <item>
      <title>Re: rename portgroup</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/rename-portgroup/m-p/2065080#M67141</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How did you change the portgroupname ?&lt;/P&gt;&lt;P&gt;With PowerCLI&lt;/P&gt;&lt;PRE __jive_macro_name="code"&gt;
Get-VMHost &amp;lt;esx-name&amp;gt; | Get-VirtualPortGroup -Name &amp;lt;current-pg-name&amp;gt; | Set-VirtualPortGroup -Name &amp;lt;new-pg-name&amp;gt;
&lt;/PRE&gt;&lt;P&gt;or did you use the &lt;A href="http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.host.NetworkSystem.html#updatePortGroup"&gt;UpdatePortGroup&lt;/A&gt; method ?&lt;/P&gt;&lt;PRE __jive_macro_name="code"&gt;
$oldName = &amp;lt;current-pg-name&amp;gt;
$newName = &amp;lt;new-pg-name&amp;gt;
$esx = Get-VMHost &amp;lt;esx-name&amp;gt; | Get-View
$netSys = Get-View $esx.ConfigManager.NetworkSystem
$pg = $esx.Config.Network.Portgroup | where {$_.Spec.Name -eq $oldName}
$spec = $pg.Spec
$spec.Name = $newName
$netSys.UpdatePortGroup($oldName, $spec)
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;____________&lt;/P&gt;&lt;P&gt;Blog: &lt;A href="http://lucd.info"&gt;LucD notes&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Twitter: &lt;A href="http://twitter.com/lucd22"&gt;lucd22&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Feb 2010 19:02:51 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/rename-portgroup/m-p/2065080#M67141</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2010-02-11T19:02:51Z</dc:date>
    </item>
    <item>
      <title>Re: rename portgroup</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/rename-portgroup/m-p/2065081#M67142</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI and thanks&lt;/P&gt;&lt;P&gt;I understand both of them (at least i think so)&lt;/P&gt;&lt;P&gt;But my question is what will happen to all the VM's that are connected to this portgroup?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Feb 2010 19:21:20 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/rename-portgroup/m-p/2065081#M67142</guid>
      <dc:creator>roneng</dc:creator>
      <dc:date>2010-02-11T19:21:20Z</dc:date>
    </item>
    <item>
      <title>Re: rename portgroup</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/rename-portgroup/m-p/2065082#M67143</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As long as the VMs are powered on they will display the "old" name in the Settings.&lt;/P&gt;&lt;P&gt;I suspect that's because the name is just a property of the portgroup.&lt;/P&gt;&lt;P&gt;Internally ESX doesn't use the actual name to find out which portgroup is connected to a VM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the guest is restarted you will see the "new" portgroup name.&lt;/P&gt;&lt;P&gt;And that is probably because at that point the vSphere client reads all the properties for the connected devices.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;____________&lt;/P&gt;&lt;P&gt;Blog: &lt;A href="http://lucd.info"&gt;LucD notes&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Twitter: &lt;A href="http://twitter.com/lucd22"&gt;lucd22&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Feb 2010 19:28:37 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/rename-portgroup/m-p/2065082#M67143</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2010-02-11T19:28:37Z</dc:date>
    </item>
    <item>
      <title>Re: rename portgroup</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/rename-portgroup/m-p/2065083#M67144</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm about to rename quite a few of our portgroups to match our naming convention. Given the second method is more complex (compared to the one liner) is there are reason to use it? Any difference in the two approaches?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ed. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Aug 2010 15:42:47 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/rename-portgroup/m-p/2065083#M67144</guid>
      <dc:creator>edgrigson</dc:creator>
      <dc:date>2010-08-13T15:42:47Z</dc:date>
    </item>
    <item>
      <title>Re: rename portgroup</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/rename-portgroup/m-p/2065084#M67145</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No, use the first method.&lt;/P&gt;&lt;P&gt;The 2nd method is the SDK based and was used when previous builds of PowerCLI didn't have the feature yet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;____________&lt;/P&gt;&lt;P&gt;Blog: &lt;A href="http://lucd.info"&gt;LucD notes&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Twitter: &lt;A href="http://twitter.com/lucd22"&gt;lucd22&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Aug 2010 17:10:47 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/rename-portgroup/m-p/2065084#M67145</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2010-08-13T17:10:47Z</dc:date>
    </item>
    <item>
      <title>Re: rename portgroup</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/rename-portgroup/m-p/2065085#M67146</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the quick reply, much appreciated. Presumably I'll need to  &lt;/P&gt;&lt;P&gt;recurse through all our hosts to see which have that portgroup  &lt;/P&gt;&lt;P&gt;defined? Is there a more efficient way - do the properties of a  &lt;/P&gt;&lt;P&gt;portgroup include the hosts using it? I 'm guessing not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ed&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sent from my iPhone&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Aug 2010 18:47:54 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/rename-portgroup/m-p/2065085#M67146</guid>
      <dc:creator>edgrigson</dc:creator>
      <dc:date>2010-08-13T18:47:54Z</dc:date>
    </item>
    <item>
      <title>Re: rename portgroup</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/rename-portgroup/m-p/2065086#M67147</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A quick way to find all the hosts that have a portgroup with a specific name is the following&lt;/P&gt;&lt;PRE __jive_macro_name="code"&gt;
$pgName = "MyPG"
Get-VMHost | %{
	if($_ | Get-VirtualPortGroup -Name $pgName -ea SilentlyContinue){
		$_.Name
	}
}
&lt;/PRE&gt;&lt;P&gt;Note the -ea (-ErrorAction) parameter. It avoids error messages for those host where the portgroup is not present.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;____________&lt;/P&gt;&lt;P&gt;Blog: &lt;A href="http://lucd.info"&gt;LucD notes&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Twitter: &lt;A href="http://twitter.com/lucd22"&gt;lucd22&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Aug 2010 18:53:56 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/rename-portgroup/m-p/2065086#M67147</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2010-08-13T18:53:56Z</dc:date>
    </item>
    <item>
      <title>Re: rename portgroup</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/rename-portgroup/m-p/2065087#M67148</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Fab, thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sent from my iPhone&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Aug 2010 21:07:54 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/rename-portgroup/m-p/2065087#M67148</guid>
      <dc:creator>edgrigson</dc:creator>
      <dc:date>2010-08-13T21:07:54Z</dc:date>
    </item>
    <item>
      <title>Re: rename portgroup</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/rename-portgroup/m-p/2065088#M67149</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Interestingly Luc's earlier comment about not needing to change the VM properties doesn't seem correct. If I change the&lt;/P&gt;&lt;P&gt;portgroup name (using Get-Host | Get-VirtualPortGroup |&lt;/P&gt;&lt;P&gt;Set-VirtualPortGroup -Name) and then check the VM settings the entry&lt;/P&gt;&lt;P&gt;for the relevant network card name is indeed blank. The problem is that&lt;/P&gt;&lt;P&gt;if I restart the VM (or even if I power off then back on) the NIC still&lt;/P&gt;&lt;P&gt;shows a blank entry and is disconnected. &lt;EM&gt;This means if you don't follow up and rename the portgroup settings for the VMs they'll drop off the network on the next reboot&lt;/EM&gt;. I'm testing this on vSphere&lt;/P&gt;&lt;P&gt;4.0U1.Here's another  &lt;A href="https://communities.vmware.com/t-194691"&gt;thread with a similar conclusion&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It also means the 'network' view in the VI client is&lt;/P&gt;&lt;P&gt;misleading - both the old and new network (portgroup) names are shown&lt;/P&gt;&lt;P&gt;and the VMs are shown (correctly) as being attached to the old network.The fix is to change the host portgroups using Luc's code and then update all the VMs to reflect the correct portgroup name - Al Renouf has already covered how to update multiple VMs, see &lt;A href="http://www.virtu-al.net/2009/10/19/powercli-mass-vm-portgroup-change/"&gt;this thread&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ed&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Aug 2010 14:21:04 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/rename-portgroup/m-p/2065088#M67149</guid>
      <dc:creator>edgrigson</dc:creator>
      <dc:date>2010-08-16T14:21:04Z</dc:date>
    </item>
  </channel>
</rss>

