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

 
Participant
6 months, 3 weeks ago.

  • Author
    Posts
  • #101226

    Participant
    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

    Keymaster
    Points: 1,704
    Helping HandTeam Member
    Rank: Community Hero

    Nope.

  • #101230

    Participant
    Points: 0
    Rank: Member

    haha. Please don't be so -Verbose!
    t/y

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