updatedvPortgroupAutoExpand.pl

Version 1

    Script to view and enable/disable Auto Expand for a distributed portgroup in vSphere 5.

     

    Author: William Lam

     

    For more details, please visit http://blogs.vmware.com/vsphere/automation/

     

    Usage:

    ./updatedvPortgroupAutoExpand.pl
    Required command option 'operation' not specified.

     

    Synopsis: ./updatedvPortgroupAutoExpand.pl OPTIONS

     


    Command-specific options:
       --dvportgroup
          Name of Distributed Portgroup to perform operatoin ona
       --dvswitch
          Name of Distributed vSwitch to check
       --operation (required)
          Operation [list|enable|disable]

     

    Common VI options:
       --config (variable VI_CONFIG)
          Location of the VI Perl configuration file
       --credstore (variable VI_CREDSTORE)
          Name of the credential store file defaults to <HOME>/.vmware/credstore/vicredentials.xml on Linux and <APPDATA>/VMware/credstore/vicredentials.xml on Windows
       --encoding (variable VI_ENCODING, default 'utf8')
          Encoding: utf8, cp936 (Simplified Chinese), iso-8859-1 (German), shiftjis (Japanese)
       --help
          Display usage information for the script
       --passthroughauth (variable VI_PASSTHROUGHAUTH)
          Attempt to use pass-through authentication
       --passthroughauthpackage (variable VI_PASSTHROUGHAUTHPACKAGE, default 'Negotiate')
          Pass-through authentication negotiation package
       --password (variable VI_PASSWORD)
          Password
       --portnumber (variable VI_PORTNUMBER)
          Port used to connect to server
       --protocol (variable VI_PROTOCOL, default 'https')
          Protocol used to connect to server
       --savesessionfile (variable VI_SAVESESSIONFILE)
          File to save session ID/cookie to utilize
       --server (variable VI_SERVER, default 'localhost')
          VI server to connect to. Required if url is not present
       --servicepath (variable VI_SERVICEPATH, default '/sdk/webService')
          Service path used to connect to server
       --sessionfile (variable VI_SESSIONFILE)
          File containing session ID/cookie to utilize
       --url (variable VI_URL)
          VI SDK URL to connect to. Required if server is not present
       --username (variable VI_USERNAME)
          Username
       --verbose (variable VI_VERBOSE)
          Display additional debugging information
       --version
          Display version information for the script


    View all distributed portgroups (name, number of ports, Auto Expand status):

    ./updatedvPortgroupAutoExpand.pl --server pod-vc --username root --operation list
    Enter password:
    dvSwitch: dvSwitch1
       dvSwitch-DVUplinks-462    4    false
       Development    10    false
       Stage    2    false
    dvSwitch: dvSwitch2
       dvSwitch2-DVUplinks-476    0    false
       dvPortGroup    128    false

     

    Enable Auto Expand for a distributed portgroup:

    ./updatedvPortgroupAutoExpand.pl --server pod-vc --username root --operation disable--dvportgroup Stage
    Enter password:
    Enabling Auto Expand for dvPortgroup "Stage" ...
       Successfully reconfigured dvPortgroup!

     

    Disable Auto Expand for a distributed portgroup:

    ./updatedvPortgroupAutoExpand.pl --server pod-vc --username root --operation disable--dvportgroup Stage
    Enter password:
    Disabling Auto Expand for dvPortgroup "Stage" ...
       Successfully reconfigured dvPortgroup!