There is so much information to provide on PowerShell profiles that really a blog post dedicated to this question would be better, and is something I will probably do. For now however here is a shorter more basic answer.
A PowerShell Profile is a PowerShell script that runs when you open either the PowerShell console or the PowerShell ISE. As your PowerShell profile is a PowerShell script you need to define your script execution policy. There are actually 6 PowerShell profiles which are easiest to explain as a table. For reference “current user” refers to the person who has created the profile for their account only as the PowerShell profile is actually stored within the user’s Windows Profile.
Profile | Description | Path |
Current User, Current Host (ISE) | This script will run when the current user opens their PowerShell ISE | C:\Users\[USERNAME]\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1 |
Current User, Current Host (Console) | This script will run when the current user opens their PowerShell Console | C:\Users\[USERNAME]\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 |
Current User, All Hosts | This script will run when the current user opens either their PowerShell ISE or PowerShell Console | C:\Users\[USERNAME]\Documents\WindowsPowerShell\profile.ps1 |
All Users, Current Host (ISE) | This script will run for all users when they open their PowerShell ISE | C:\Windows\System32\WindowsPowerShell\v1.0\Microsoft.PowerShellISE_profile.ps1 |
All Users, Current Host (Console) | This script will run for all users when they open their PowerShell Console | C:\Windows\System32\WindowsPowerShell\v1.0\Microsoft.PowerShell_profile.ps1 |
All Users, All Hosts | This script will run for all users when they open either their PowerShell ISE or PowerShell Console | C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1 |
For current user profiles you will need to replace [USERNAME] in the path with your Windows Username. Trying to edit one of these profiles but it’s not there? You need to create these profiles to start using them (you can simply create the specified file in the appropriate path as per the above table).
As I said at the beginning of this answer, PowerShell profiles deserve their own blog post as the above is just a brief answer there is still much more to cover.