Create a basic profile
suggest changeA PowerShell profile loads user-defined variables and functions automatically.
PowerShell does not create profile files for you.
To create a profile for the current host, create the parent folder if it is missing, then create the file:
New-Item -ItemType File -Path $PROFILE -Force
In the ISE you can open it with the built-in editor:
psEdit $PROFILE
An easy way to get started with your personal profile for the current host is to save some text to the path stored in $PROFILE:
"#Current host, current user" > $profile
Further modification to the profile can be done using PowerShell ISE, notepad, Visual Studio Code or any other editor.
The $profile-variable returns the current user profile for the current host by default, but you can access the path to the machine-policy (all users) and/or the profile for all hosts (console, ISE, 3rd party) by using it’s properties.
PS> $PROFILE | Format-List -Force
AllUsersAllHosts : C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1
AllUsersCurrentHost : C:\Windows\System32\WindowsPowerShell\v1.0\Microsoft.PowerShell_profile.ps1
CurrentUserAllHosts : C:\Users\user\Documents\WindowsPowerShell\profile.ps1
CurrentUserCurrentHost : C:\Users\user\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
Length : 75
PS> $PROFILE.AllUsersAllHosts
C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1