<?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: How to change port group and IP on management port - at the same time in VMware PowerCLI Discussions</title>
    <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-to-change-port-group-and-IP-on-management-port-at-the-same/m-p/2853131#M101940</link>
    <description>&lt;P&gt;Afaik, there is indeed no cmdlet to combine those actions.&lt;/P&gt;
&lt;P&gt;It does seem to be possible with the &lt;A href="https://vdc-download.vmware.com/vmwb-repository/dcr-public/b50dcbbf-051d-4204-a3e7-e1b618c1e384/538cf2ec-b34f-4bae-a332-3820ef9e7773/vim.host.NetworkSystem.html#updateVirtualNic" target="_blank" rel="noopener"&gt;UpdateVirtualNIC&lt;/A&gt; API method.&lt;BR /&gt;&lt;BR /&gt;The following snippet is for a vmkernel that is moved from one VDS porgroup to another one.&lt;BR /&gt;It should be similar for a VSS based VMKernel, just use the Portgroup property instead of the DistributedVirtualPort property.&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;$esxName = '&amp;lt;MyESx&amp;gt;'
$vmkName = 'vmkx'

$newPG = '&amp;lt;new-vdPG&amp;gt;'

$esx = Get-VMHost -Name $esxName
$pg = Get-VDPortgroup -Name $newPG

$netSys = Get-View -Id $esx.ExtensionData.ConfigManager.NetworkSystem

$spec = New-Object -type VMware.Vim.HostVirtualNicSpec
$spec.Ip = New-Object -TypeName VMware.Vim.HostIPConfig
$spec.IP.Dhcp = $true
$spec.DistributedVirtualPort = New-Object -TypeName VMware.Vim.DistributedVirtualSwitchPortConnection
$spec.DistributedVirtualPort.SwitchUuid = $pg.vdswitch.ExtensionData.Uuid
$spec.DistributedVirtualPort.PortgroupKey = $pg.ExtensionData.Key

$netSys.UpdateVirtualNic($vmkName, $spec)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 17 Jun 2021 06:17:29 GMT</pubDate>
    <dc:creator>LucD</dc:creator>
    <dc:date>2021-06-17T06:17:29Z</dc:date>
    <item>
      <title>How to change port group and IP on management port - at the same time</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-to-change-port-group-and-IP-on-management-port-at-the-same/m-p/2853097#M101939</link>
      <description>&lt;P&gt;I have gone around in circles on this, but using PowerCLI I cannot find a way to change a vmkernel NIC's port group AND IP at the same time (actually trying to change to DHCP, but same problem. It seems if you need to change the port group the option to change anything about the IP is not available. So, there is no way to fix this without using a IPMI remote console it seems.&lt;/P&gt;&lt;P&gt;Any suggestions would be appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 22:28:56 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-to-change-port-group-and-IP-on-management-port-at-the-same/m-p/2853097#M101939</guid>
      <dc:creator>DavidGriswoldeB</dc:creator>
      <dc:date>2021-06-16T22:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to change port group and IP on management port - at the same time</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-to-change-port-group-and-IP-on-management-port-at-the-same/m-p/2853131#M101940</link>
      <description>&lt;P&gt;Afaik, there is indeed no cmdlet to combine those actions.&lt;/P&gt;
&lt;P&gt;It does seem to be possible with the &lt;A href="https://vdc-download.vmware.com/vmwb-repository/dcr-public/b50dcbbf-051d-4204-a3e7-e1b618c1e384/538cf2ec-b34f-4bae-a332-3820ef9e7773/vim.host.NetworkSystem.html#updateVirtualNic" target="_blank" rel="noopener"&gt;UpdateVirtualNIC&lt;/A&gt; API method.&lt;BR /&gt;&lt;BR /&gt;The following snippet is for a vmkernel that is moved from one VDS porgroup to another one.&lt;BR /&gt;It should be similar for a VSS based VMKernel, just use the Portgroup property instead of the DistributedVirtualPort property.&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;$esxName = '&amp;lt;MyESx&amp;gt;'
$vmkName = 'vmkx'

$newPG = '&amp;lt;new-vdPG&amp;gt;'

$esx = Get-VMHost -Name $esxName
$pg = Get-VDPortgroup -Name $newPG

$netSys = Get-View -Id $esx.ExtensionData.ConfigManager.NetworkSystem

$spec = New-Object -type VMware.Vim.HostVirtualNicSpec
$spec.Ip = New-Object -TypeName VMware.Vim.HostIPConfig
$spec.IP.Dhcp = $true
$spec.DistributedVirtualPort = New-Object -TypeName VMware.Vim.DistributedVirtualSwitchPortConnection
$spec.DistributedVirtualPort.SwitchUuid = $pg.vdswitch.ExtensionData.Uuid
$spec.DistributedVirtualPort.PortgroupKey = $pg.ExtensionData.Key

$netSys.UpdateVirtualNic($vmkName, $spec)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jun 2021 06:17:29 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-to-change-port-group-and-IP-on-management-port-at-the-same/m-p/2853131#M101940</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2021-06-17T06:17:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to change port group and IP on management port - at the same time</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-to-change-port-group-and-IP-on-management-port-at-the-same/m-p/2853307#M101967</link>
      <description>&lt;P&gt;I gave this a try and I am hitting an error concerning '&lt;SPAN&gt;DistributedVirtualPort'. I did not think it would be as simple as replacing that with 'Portgroup', but I gave it a try and that did not work either. I assume I need to use a different type with this line as well:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;$spec.DistributedVirtualPort = New-Object -TypeName VMware.Vim.DistributedVirtualSwitchPortConnection&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can't I just not include 'DistributedVirtualPort' in the spec and instead use the 'portgroup'&amp;nbsp;&lt;SPAN&gt;Property? If so, I don't know what type to&amp;nbsp;instantiate.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DavidGriswoldeB_0-1623947410329.png" style="width: 400px;"&gt;&lt;img src="https://communities.vmware.com/t5/image/serverpage/image-id/89585iA1647FDF6D26A24F/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="DavidGriswoldeB_0-1623947410329.png" alt="DavidGriswoldeB_0-1623947410329.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jun 2021 16:46:00 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-to-change-port-group-and-IP-on-management-port-at-the-same/m-p/2853307#M101967</guid>
      <dc:creator>DavidGriswoldeB</dc:creator>
      <dc:date>2021-06-17T16:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to change port group and IP on management port - at the same time</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-to-change-port-group-and-IP-on-management-port-at-the-same/m-p/2853313#M101968</link>
      <description>&lt;P&gt;I updated the script using this instead and I am getting a puzzling error, below. If I just run 'New-Object -TypeName VMware.Vim.HostPortgroup' I can see the structure of the object, but when it is added to '$spec', get-method says it is just string, not the HostPortgroup object.&lt;/P&gt;&lt;P&gt;$spec.Portgroup = New-Object -TypeName VMware.Vim.HostPortgroup&lt;BR /&gt;$spec.Portgroup.Key = $pg.ExtensionData.Key&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DavidGriswoldeB_0-1623948806706.png" style="width: 400px;"&gt;&lt;img src="https://communities.vmware.com/t5/image/serverpage/image-id/89587i0916FCEDA44CC8A3/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="DavidGriswoldeB_0-1623948806706.png" alt="DavidGriswoldeB_0-1623948806706.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jun 2021 16:55:46 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-to-change-port-group-and-IP-on-management-port-at-the-same/m-p/2853313#M101968</guid>
      <dc:creator>DavidGriswoldeB</dc:creator>
      <dc:date>2021-06-17T16:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to change port group and IP on management port - at the same time</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-to-change-port-group-and-IP-on-management-port-at-the-same/m-p/2853334#M101971</link>
      <description>&lt;P&gt;When you use a VSS portgroup, the Portgroup property is indeed just s string.&lt;BR /&gt;Place the name of the Portgroup in there, not the Key&lt;BR /&gt;&lt;BR /&gt;Note: you can not use the DistributedVirtualPort property when you use the Portgroup property&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jun 2021 18:47:22 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-to-change-port-group-and-IP-on-management-port-at-the-same/m-p/2853334#M101971</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2021-06-17T18:47:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to change port group and IP on management port - at the same time</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-to-change-port-group-and-IP-on-management-port-at-the-same/m-p/2853344#M101975</link>
      <description>&lt;P&gt;I am getting a new error now: The Specified Parameter was not correct: VirtualNic.Specification.Portgroup&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DavidGriswoldeB_0-1623958298323.png" style="width: 400px;"&gt;&lt;img src="https://communities.vmware.com/t5/image/serverpage/image-id/89589i1F5AB5950E71B4DB/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="DavidGriswoldeB_0-1623958298323.png" alt="DavidGriswoldeB_0-1623958298323.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jun 2021 19:34:55 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-to-change-port-group-and-IP-on-management-port-at-the-same/m-p/2853344#M101975</guid>
      <dc:creator>DavidGriswoldeB</dc:creator>
      <dc:date>2021-06-17T19:34:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to change port group and IP on management port - at the same time</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-to-change-port-group-and-IP-on-management-port-at-the-same/m-p/2853347#M101976</link>
      <description>&lt;P&gt;Come to think of it, how did you define a VMKernel on a VSS portgroup?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jun 2021 19:44:33 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-to-change-port-group-and-IP-on-management-port-at-the-same/m-p/2853347#M101976</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2021-06-17T19:44:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to change port group and IP on management port - at the same time</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-to-change-port-group-and-IP-on-management-port-at-the-same/m-p/2853352#M101977</link>
      <description>&lt;P&gt;I figured out my mistake and went back to the original script using&amp;nbsp;DistributedVirtualPort, but unfortunately the change timesout and does not seem execute both changes at the same time. Neither the old static IP on the old portgroup or the DHCP assigned IP on the new portgroup are responding.&lt;/P&gt;&lt;P&gt;I will need to go back to my first idea of adding a new vmkernel NIC and removing vmk0. Not ideal, but it will work.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jun 2021 20:07:12 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-to-change-port-group-and-IP-on-management-port-at-the-same/m-p/2853352#M101977</guid>
      <dc:creator>DavidGriswoldeB</dc:creator>
      <dc:date>2021-06-17T20:07:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to change port group and IP on management port - at the same time</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-to-change-port-group-and-IP-on-management-port-at-the-same/m-p/2861371#M102673</link>
      <description>&lt;P&gt;I gave up on this. There appears to be no way to change both the IP of the management vmKernel interface and it's backing port group, on virtual distributed switches, at the same time via any API. You can do it using standard switches, but not vDS.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had to make all of the changes manually in the DCUI via remote console. It was a pain and there needs to be a better way to do this.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Aug 2021 19:38:05 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-to-change-port-group-and-IP-on-management-port-at-the-same/m-p/2861371#M102673</guid>
      <dc:creator>DavidGriswoldeB</dc:creator>
      <dc:date>2021-08-09T19:38:05Z</dc:date>
    </item>
  </channel>
</rss>

