#PSTip Tab complete properties

Tab completion is a well-known feature in PowerShell, which speeds up the process of typing and reduces the risk for typing mistakes. The feature can autocomplete things like nouns and parameters, as well as values for parameters if PowerShell knows what type of object the parameter is expecting. The first two has been around since version 2.0, while the latter was introduced in version 3.0.

A less known feature is that the -Property parameter of Select-Object and the Format- cmdlets has supported parameter value completion since version 2.0.

Let us have a look at this feature in action. In the first example run in the PowerShell ISE, we press Ctrl + Space to bring up the tab completion feature:


In the second example, we use the Tab key to invoke tab completion:

When using the Tab key, the feature also works in the console host (powershell.exe):


The PSReadLine module (included by default in Windows 10/WMF5 and later), also provides support for Ctrl + Space in the console host:


About the author: Jan Egil Ring

Jan Egil works as a Lead Architect at Crayon, Norway. He mainly works with automation, and has a strong passion for PowerShell. He has been working with Microsoft infrastructure products such as Windows Server & System Center since the early 2000s. In the recent years the focus has been more and more related to cloud technologies in Microsoft Azure and hybrid environments. He is a multiple-year recipient of Microsoft Most Valuable Professional Award for his contributions in the Windows PowerShell and Cloud & Datacenter Management technical communities. He speaks regularly at user groups and conferences, such as Nordic Infrastructure Conference (NIC), PowerShell Conference Europe and PowerShell Summit. He is a co-organizer of Azure User Group Norway as well as the MTUG (Microsoft Technology User Group) Script Club which focuses mainly on PowerShell. You can follow him on Twitter @JanEgilRing.

Related Posts