Skip to content

Get-Help does not resolve aliases to scripts if they are not in the path #2899

Closed

Description

The original bug is filed here, PowerShell v5.1
I can reproduce it with the latest powershell-6.0.0-alpha.14-win7-x86.

Here is the description of the issue and steps to reproduce.

Create a directory C:\TEMP\HelpAlias (we assume it is not in the path yet).

Create a script Test-Me.ps1 in it:

<#
.Synopsis
    Test help

.Description
    Test help
#>

Open a PowerShell console and invoke the following commands:

    0> Set-Alias zz C:\TEMP\HelpAlias\Test-Me.ps1
    0> Get-Help zz

        Name          : zz
        Category      : Alias
        Synopsis      : Test-Me.ps1
        Component     :
        Role          :
        Functionality :

    0> $env:path = $env:path + ';C:\TEMP\HelpAlias'
    0> Get-Help zz

        NAME
            C:\TEMP\HelpAlias\Test-Me.ps1

        SYNOPSIS
            Test help

        SYNTAX
            C:\TEMP\HelpAlias\Test-Me.ps1 [<CommonParameters>]

        DESCRIPTION
            Test help

Expected behavior

Get-Help works for properly defined aliases to scripts regardless of
their location, i.e. included in the path or not. In other words, the
result is the same as if Get-Help is invoked with the script path
defined by the alias.

Actual behavior

We can see that the alias zz is not resolved by Get-Help when the script is
not the path. Then it is resolved fine after adding the directory to the path
and Get-Help zz gets the expected help.

Activity

  1. added
    WG-Interactive-HelpSystem
    on Dec 19, 2016
  2. ThomasNieto commented on Aug 18, 2023

    @ThomasNieto
    Contributor

    This is still an issue on 7.4-preview4.

  3. added
    Resolution-No Activity
    on Feb 14, 2024
  4. nightroman commented on Feb 14, 2024

    @nightroman
    Author

    Bump (hopefully to prevent auto closure by the bot). This is a pain in known scenarios. Sometimes scripts distributed with a module should be just scripts and not script modules (modules have unwanted features, sometimes). The natural workaround (working, solving known issues) is scripts aliases. But help is not working...

  5. removed
    Resolution-No Activity
    on Feb 14, 2024
  6. added
    Resolution-No Activity
    on Aug 13, 2024
  7. nightroman commented on Aug 13, 2024

    @nightroman
    Author

    The issue still exists in 7.4.4

  8. removed
    Resolution-No Activity
    on Aug 13, 2024
  9. added
    Resolution-No Activity
    on Feb 10, 2025
  10. nightroman commented on Feb 10, 2025

    @nightroman
    Author

    This issue still exists in 7.5.0
    I have to bump it again to prevent auto closure by the microsoft-github-policy-service.
    If there is no further activity from the PS team then I'll probably close the issue myself. Any thoughts, plans?

  11. removed
    Resolution-No Activity
    on Feb 10, 2025
  12. microsoft-github-policy-service commented on Feb 11, 2025

    @microsoft-github-policy-service
    Contributor

    📣 Hey Roman Kuzmin 1967-2026 (@nightroman), how did we do? We would love to hear your feedback with the link below! 🗣️

    🔗 https://aka.ms/PSRepoFeedback

  13. nightroman commented on Feb 11, 2025

    @nightroman
    Author

    📣 Hey @nightroman, how did we do? We would love to hear your feedback with the link below! 🗣️

    🔗 https://aka.ms/PSRepoFeedback

    Microsoft Forms

    Suboptimal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    WG-Interactive-HelpSystem

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions