Aliasing a module

Welcome Forums General PowerShell Q&A Aliasing a module

This topic contains 2 replies, has 2 voices, and was last updated by

10 months ago.

  • Author
  • #101226

    Points: 0
    Rank: Member

    I am unable to find this anywhere on the internets.

    I understand that functions and cmdlets can be aliased using Set-Alias.

    My question, can a module name be aliased?

    For example, I have two modules that have cmdlet name collision (Get-Noun in Module1, and Get-Noun in Module2)
    Both module names are long, Microsoft.System.Automation.MoreNameSpaces1. I am not a fan of prefixing nouns in the Verb-Noun, but don't mind using the module name as part of the cmdlet call. In this case it would be Microsoft.System.Automation.MoreNameSpaces1\Get-Noun. So this can get ridiculous pretty fast.
    Is there a way to have another name (alias) to the module itself like: Set-Alias -Name Microsoft.System.Automation.MoreNameSpaces1 -Value ms1
    And then use cmdlets is this way: ms1\Get-Noun

    Hope I'm being clear.
    Thank you in advance.

  • #101227

    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero


  • #101230

    Points: 0
    Rank: Member

    haha. Please don't be so -Verbose!

The topic ‘Aliasing a module’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort