New-AliasLoop Script

Why does this not work to create multiple alias?

Function New-AliasLoop {
    $newalias = Read-Host "Would you like to create a new alias? Y/N"
    While (($newalias -eq "Y") -or ($newalias -eq "Yes")){
    $aliasname = Read-Host "What would you like this alias to be called?"
    $aliasvalue = Read-Host "What would you like this alias to represent?"

    New-Alias -Name $aliasname -Value $aliasvalue

    $newalias = Read-Host "Would you like to create a new alias? Y/N"
    }
}

Well, the code iterates fine till the answer is N/No, but the created alias lives in the function scope and won’t be available out side.

New-Alias has a -Scope parameter, you can pass Global to it, hence it will be available in global scope.