PowerShell profiles are really just scripts that run when you launch PowerShell. Anything you can put in a PowerShell script you can put in a PowerShell profile. So if you have a common set of PowerShell Modules that you load every time you start PowerShell then creating a PowerShell Profile is something you should consider.
Where are PowerShell Profiles located?
PowerShell Profiles are stored in a unique location for every user. The location is typically c:\users\username\documents\WindowsPowerShell\Profile.ps1. You can find the location of your PowerShell profile by printing the $profile variable in PowerShell.
Now this location doesn’t actually exist but is the default location for the PowerShell profile.
Lets Create PowerShell Profiles
So to create a PowerShell Profile we are first going browse to the location that we found in the $profile variable. If the “WindowsPowerShell” folder does not exist go ahead and create it.
Next we are going to create a new text file and name it Profile.ps1. .PS1 is the default extension for PowerShell script files. Like I said in the beginning PowerShell Profiles are really only just PowerShell scripts.
Now that we have our Profile.ps1 file created lets open it in your favorite text editor. Personally I like to use ISE because it is meant to edit PowerShell Scripts. Now we can type anything we want in this PowerShell script and it will run every time we launch PowerShell.
So I am just going to make sure that the Defender Module will load every time I launch PowerShell. So I will type:
Now lets launch PowerShell again
It may not look like anything has changed here but lets look at the loaded Modules by typing
We can see that the Defender Module is loaded which means our Profile.ps1 script was executed on launch.
I hope this gives you some ideas of how you can create PowerShell Profiles to fit your needs as an administrator. In reality the sky is the limit here.