Windows PowerShell Home
PS4 Repeated Alias Exports break PowerShell
Joel 'Jaykul' Bennett
7/2/2013 1:58:58 PM
User(s) can reproduce this bug
Listing the same alias twice in a module's AliasesToExport will cause PowerShell to hang whenever any command is not found.
How often does this happen?
Have you seen this problem before in this product?
No, this is new to the most recent version
Create a folder "Bug" in your PSModulePath and generate the following Bug.psd1 in it:
ModuleVersion = '1.0'
ModuleToProcess = '.\Bug.psm1'
AliasesToExport = @( 'bug', 'bug')
Now try to run a non existent command in Powershell. You'll get the standard command not found error message, but PowerShell will then freeze and not return to the prompt.
PS C:\> frack-mountain
frack-mountain : The term 'frack-mountain' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
At line:1 char:1
+ CategoryInfo : ObjectNotFound: (frack-mountain:String) , CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PowerShell should ignore multiple alias exports and treat them as one, the same as it always has.
to post a comment.
Please enter a comment.
to post a workaround.
Please enter a workaround.
© 2014 Microsoft