PowerShell by default “forgets” most settings on restart. If you’d like to “keep” settings, you use a profile script. That’s an auto start script that runs whenever PowerShell starts. You can add whatever commands you like to this script.
This line will open your current PowerShell profile script, and if there is none yet, notepad offers to create one for you:
PS C:\> notepad $profile
Now you can add this to your profile script:
"Hello $env:username!" Set-Alias -Name web -Value "$env:ProgramFiles\Internet Explorer\iexplore.exe"
You should also run this to ensure that PowerShell is allowed to run local scripts:
PS C:\> Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned -Force
Next time you open your PowerShell, it will greet you, and have a new alias called “web” that you can use to open web pages in Internet Explorer:
PS C:\> web www.powershellmagazine.com