Finding Out When A PowerShell Cmdlet Was Introduced

In the PowerShell Slack (invite yourself at bit.ly/psslack), there was a very brief debate over when the Expand-Archive cmdlet was introduced to PowerShell. This is absolutely information that can be found online, but there’s a few different ways.

Some cmdlets have this information built into the help, some share this information in the online docs. Since the core cmdlets documentation are open sourced and on GitHub, however, you can go straight to the source and quickly answer this question for yourself.

If you go to https://github.com/powershell/powershell-docs, you’ll find all the documentation for the core PowerShell cmdlets. In the Reference folder, you’ll see documentation for all the currently supported versions of PowerShell (back to 3.0). The docs for older cmdlets are in there too, but typically you’re going to be looking for if a cmdlet was introduced in version 4 or 5, in my experience.

Click on the Find File button in GitHub, and you’ll be presented with a search screen.

From there, type in the name of the cmdlet, and the search will start to populate. Let’s see when the Expand-Archive cmdlet was introduced.

You can see that this core cmdlet is in the docs for versions 5.0, 5.1 and 6. That means that we can assume this cmdlet was introduced in PowerShell version 5.

2 thoughts on “Finding Out When A PowerShell Cmdlet Was Introduced

  1. PowerShell = Automation :-):

    function Get-FirstPSVersion ($command){
    $baseUri = ‘https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Archive’
    foreach ($version in (‘3.0′,’4.0′,’5.0′,’5.1′,’6’)){
    $url = (Invoke-WebRequest -uri (“$baseUri/$command” + “?view=powershell-$version”) -MaximumRedirection 0 -ea SilentlyContinue).Headers.Location
    if ($url -notlike ‘*FallbackFrom*’){
    return [Version]$version
    }
    }
    }

    Get-FirstPSVersion Expand-Archive

  2. Hi Dirk, thanks for sharing – small problem.. the single and double quotes are not valid [wordpress does this], these are the rounds ones that word editors use. @everyone else simply replace with with correct ‘ ” and the function will work.

Leave a Reply

Your email address will not be published. Required fields are marked *