It’s being used in every PowerShell session, the PowerShell Profile. In this blog post, I will show you what it does, what you can use it for, and how I use it.
- What is the PowerShell Profile?
- Using the Profile
- How I use my profile
- TLS1.2
- Posh-Git
- PSReadLineKeyHandler
- Terminal Icons
- PSReadLineOption PredictionSource and PredictionViewStyle
- Az.Tools.Predictor
- Get-MailDomainInfo
- 365HealthStatus
- Update Modules
- Compact-VHDX
- Start-WinGetUpdate
- Install-SysInternalsSuite
- Search-EventLog
- More information
- And you?
What is the PowerShell Profile?
“A PowerShell profile is a script that runs when PowerShell starts. You can use the profile as a startup script to customize your environment. You can add commands, aliases, functions, variables, modules, PowerShell drives and more. You can also add other session-specific elements to your profile so they’re available in every session without having to import or re-create them.”
Using the Profile
By default, you have an empty Profile. You can use it to add scripts, functions, or settings that should always be there for you in every session. You can edit the the profile for your currently logged in user from within a running PowerShell session by running the following:
notepad $profile
How I use my profile
I added many functions/scripts I post here in my profile. Always nice to have them available straight away in your PowerShell session. This is how my profile is configured right now, and I will detail every line in the chapters below…

TLS1.2
The [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor [System.Net.SecurityProtocolType]::Tls12 configures the PowerShell session to use TLS 1.2. I added this to my profile when Microsoft switched to TLS1.2 for the PSGallery, and I couldn’t download things without this setting.
Posh-Git
I import the Posh-Git module into my profile to have Git indicators in my PowerShell session. It shows you in what branch you are and if changes are pending. For example:
No commit pending:

Commit pending:

PSReadLineKeyHandler
You can configure the PSReadline module for many things, this is using Tab for completing commands, but you can even use a key to run an entire ScriptBlock.
Terminal Icons
I import the Terminal Icons module to display files and folders with different colors and icons. This makes things look like this:

Note: You do have to install Nerd Fonts for this and do some updates like described here
PSReadLineOption PredictionSource and PredictionViewStyle
I use these two Set-PSReadLineOptions to enable the predictive IntelliSense feature, use history and plugin as the sources, and show the predictions in a List view. For example:

Here I typed Get-Process, and it retrieves results from my history and the AZ Predictor module.
Az.Tools.Predictor
I import this module to get predictions for Azure cmdlets, for example:

This shows (Without me having used any of the AZ Predicator’s suggestions) commands which other Admins frequently use, saving time and effort 🙂
Get-MailDomainInfo
This function I wrote last year retrieves AutoDiscover/DKIM/DMARC/MX/SPF records, and I use it often for new and existing customers when investigating things. For example:

365HealthStatus
Wrote this function last year. Every time I start a new PowerShell session, it will show (if any) the service outages:

Always nice to be up-to-date on any issues 😉
Update Modules
I wrote this function to update all my modules to the latest version and remove the old versions. This looks like this when you start it and will report which modules it updated at the end:


Note: It could take a while, depending on your installed modules.
Compact-VHDX
I wrote this function to shrink my VHDX files. It checks your Hyper-V VMs for disks that can be compacted and will report the results like this:

Start-WinGetUpdate
Wrote this function to update your local software using WinGet. Running it looks like this:

Install-SysInternalsSuite
Wrote this function to update your local SysInternals Suite (If installed manually, not the Store version). Running it looks like this:

No updates at this moment. If there is an update, it will report it after running the script.
Search-EventLog
I created this function recently. It’s a function to search your Windows Eventlog for certain EventIDs or a specific process or name. For example, running this command:
Search-Eventlog -Filter Windows -Hours 1 -EventLogName *hyper* -Gridview
Will output the results to an Out-GridView window:

More information
You can find more examples and information about profiles here.
And you?
This was my PowerShell profile. How does your one look? Let me know in the comments 🙂