VMware PowerCLI

The Best User Interface for your VMware Datacenter!

Support natural PowerShell interactive behavior (tab-completion of possible values based on inventory items in the environment, contributing to discoverability): add tab-completion support to parameter values

PowerShell provides the ability to tab-complete parameter values via argument completers.  For example:

  • Get-Process -Name <tab>
  • Get-Service -DisplayName <tab>
  • Get-Command -Module VMwar<tab>
  • Get-Variable -Name r<tab>
  • etc.

Argument completers for PowerCLI cmdlets can be extremely convenient and helpful, further optimizing the user as they travel through their PowerShell experience for the day.

I am suggesting that we add this support to PowerCLI cmdlets where it is valuable.  A short list of examples:

  • Get-VM -Name matt<tab>
  • Get-VMHost myho<tab>
  • Get-Datastore -VM matt<tab>
  • Get-VDSwitch -VMHost <tab>
  • Get-DrsVMHostRule -VMGroup <tab>
  • ...and so on -- enable tab-completion of parameter values from corresponding vSphere inventory objects

 

The following doc holds several more use cases, both for existing cmdlets in PowerShell, and some example use cases for PowerCLI cmdlets:  https://github.com/mtboren/PowerCLIFeedback/blob/master/PowerCLISuggestions.md (in the "support natural PowerShell interactive behavior" section).  The PowerCLI examples are just the beginning:  we can go through the full catalog of PowerCLI cmdlets and see where argument completers would be applicable and consider which would be most valuable.

 

In addition to being extremely convenient and helpful, and argument completers are a use-at-will feature -- if someone does not want to use them (or is unaware of them), there is no negative impact to resource utilization, cmdlet performance, etc.  Argument completers are only "invoked" when a user tries to tab-complete a parameter that has a registered argument completer.

 

Examples of using Register-ArgumentCompleter to register new argument completers for the current PowerShell session:  https://github.com/mtboren/PowerCLIFeedback/blob/master/RegisterArgumentCompleter_samples.ps1

 

Other info:  Modern PowerShell supports registering argument completers with the Register-ArgumentCompleter cmdlet.  Previous versions of PowerShell also have support for argument completers, as described in various locations around the web.

  • Matt Boren
  • Oct 26 2017
  • Attach files