Introduction
After installing PowerShell, we often add extra extensions such as:
- PSFzf: Provides fuzzy search functionality.
- zoxide: Enables quick navigation of the file system.
- posh-git: Offers Git command prompts and autocompletion.
- Oh My Posh: Enhances PowerShell prompt styles.
- And more…
These plugins can be integrated into PowerShell as per their installation methods.
However, they can cause slow loading times, making each PowerShell startup lengthy.
This article will detail and document my process of solving this issue.
Identifying the Problem
First, in PowerShell, enter the following command to edit the user profile:
|
|
Currently, the profile loads PSFzf and zoxide modules as shown below.
|
|
Opening PowerShell shows a load time of approximately 2000 milliseconds. Using pwsh --noProfile
, you can temporarily bypass the profile loading to assess if it is causing the delay.
|
|
You will notice the load time is faster, indicating that the profile loading is indeed the issue.
Referencing PowerShell’s official issue, others have experienced similar problems, which were resolved by disabling antivirus software.
Antivirus Impact
I use Bitdefender, which features a Scan scripts
function. Disabling this function restored normal load times. During testing, turning off Bitdefender Shield also improved load times.
Solution
You can add trusted script locations to the exception list. Using the Everything tool, search for keywords like psfzf or zoxide to find paths such as:
|
|
Adding these paths to Bitdefender’s exception list should reduce load times to under 500 milliseconds when opening a new PowerShell window.
However, modules like posh-git have inherently slow load times, which are not improved even when antivirus software is disabled or when they are added to the exception list.