PowerShell Powershell profiles

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Remarks

Profile file is a powershell script that will run while the powershell console is starting. This way we can have our environment prepared for us each time we start new powershell session.

Typical things we want to do on powershell start are:

  • importing modules we use often (ActiveDirectory, Exchange, some specific DLL)
  • logging
  • changing the prompt
  • diagnostics

There are several profile files and locations that have different uses and also hierarchy of start-up order:

HostUserPathStart orderVariable
AllAll%WINDIR%\System32\WindowsPowerShell\v1.0\profile.ps11$profile.AllUsersAllHosts
AllCurrent%USERPROFILE%\Documents\WindowsPowerShell\profile.ps13$profile.CurrentUserAllHosts
ConsoleAll%WINDIR%\System32\WindowsPowerShell\v1.0\Microsoft.PowerShell_profile.ps12$profile.AllUsersCurrentHost
ConsoleCurrent%USERPROFILE%\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps14$profile.CurrentUserCurrentHost
ISEAll%WINDIR%\System32\WindowsPowerShell\v1.0\Microsoft.PowerShellISE_profile.ps12$profile.AllUsersCurrentHost
ISECurrent%USERPROFILE%\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps14$profile.CurrentUserCurrentHost


Got any PowerShell Question?