/ #powershell #setup 

Setup A Powershell Profile

Create a $Profile without Admin Privileges

Like ~/.bashrc for bash, a Powershell profile allows you to load aliases or functions when you open a new terminal. While there are technically 6 Powershell profiles, we are only concerned with $Profile, which aliases to $Profile.CurrentUserCurrentHost.

  1. Open powershell and create a profile file if it does not exist.

    # New-Item = bash's touch
    New-Item -Path $Profile -ItemType "file"
    
    1. (Required only on Windows) Set your ExecutionPolicy to allow local scripts.

    Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force

    1. (Recommended if Admin) Add %Program Files% to $PATH

    [Environment]::SetEnvironmentVariable(
            "PATH", "$PATH;$ENV:ProgramFiles", "Machine")

    1. (Optional) Edit your profile with Start notepad $Profile on Windows / nano $Profile on *nix. Some people like to add Useful Functions while others like tricking out their consoles with 🎛module paths, ⛈️weather, and 👽aliens. I like Windows-Screenfetch (Add Screenfetch 2> $Null to your $Profile)

    Setting up Powershell Profiles with Screenfetch