Issue: Powershell Attempts to Load Modules from UNC Path
When users at my workplace have their folders redirected to a UNC path, this affects the performance of my PowerShell. Every time I start up PowerShell, it takes a long time to load modules from the UNC path. This also affects how I use cmdlets because it tries to search the UNC path for cmdlet context.
$env:PSModulePath
This command shows the UNC directory, however it doesn’t show up in System’s Environment Variables dialog editor.
Objective
I want to get rid of the UNC directory so that PowerShell doesn’t keep looking for module support from the UNC directory.
Editing an existing session’s $env:PSModulePath would be a temporary fix, but I need a permanent solution.
To permanently remove the UNC path from PowerShell’s module path, follow these steps:
Open the “System Properties” dialog by right-clicking “This PC” and selecting “Properties”.
Click on “Advanced system settings” on the left sidebar.
Click on the “Environment Variables” button at the bottom of the “Advanced” tab.
Under “System Variables”, find the “PSModulePath” variable and click “Edit”.
Remove the UNC path from the list of paths, making sure to separate each path with a semicolon (;).
Click “OK” to close all windows.
Note that this change will affect all users on the computer, not just the current user. If you only want to remove the UNC path for the current user, edit the “PSModulePath” variable under “User Variables” instead.