VMware Cloud Community
Vimal348
Enthusiast
Enthusiast

Disable dvPort AutoExpand

Hello,

I have a vCenter and it has almost 100+ dvPortgroups and 20+ Standard Switches. My vCenter is 6.7. In Vmware site, I saw that the feature AutoExpand is enabled by default from vCenter 5.1.

Here my intention is disable 'AutoExpand' only for dvPortgroups with a powershell Script.

Manual task is time consuming. Can someone please help me to share the powershell script that can achieve that task ?

0 Kudos
1 Reply
LucD
Leadership
Leadership

You could do something like this

$spec = New-Object -TypeName VMware.Vim.DVPortgroupConfigSpec

$spec.AutoExpand = $false


$sView = @{

    ViewType = 'DistributedVirtualPortgroup'

    Property = 'Config.AutoExpand','Config.ConfigVersion'

    Filter = @{

        'Config.AutoExpand'='True'

    }

    PipelineVariable = 'pg'

}

Get-View @sView |

ForEach-Object -Process {

    $spec.ConfigVersion = $pg.Config.ConfigVersion

    $pg.ReconfigureDVPortgroup($spec)

}


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

0 Kudos