I've noticed that whenever I SSH into a Windows 11 host with Z-Location as part of the profile that it takes 2-3 minutes to load my profile.
I've narrowed it down to Z-Location. Then, still in SSH, I started a new instance of pwsh -noprofile and manually ran the steps of the ZLocation.psm1 file to narrow down the slow part. The slow parts are:
Get-FrequentFolders | ForEach-Object {Add-ZWeight -Path $_ -Weight 0} which takes 260 seconds

Get-FrequentFolders by itself takes 320 seconds
$QuickAccess = New-Object -ComObject shell.application takes 0.0022 seconds
$QuickAccess.Namespace("shell:::{679f85cb-0220-4080-b29b-5540cc05aab6}") takes 0.012 seconds
$QuickAccess.Namespace("shell:::{679f85cb-0220-4080-b29b-5540cc05aab6}").Items() takes 320 seconds
- The same call in the same shell in a terminal in the remote desktop of the host executes in 0.1 seconds
(I'm aware I'm using a slightly older version of z-location but the content of the functions in question are not substantially different)
I've disabled the Get-FrequentFolders part of the powershell module on my remote host and now profile loading is almost instant again.
I don't think the root cause of this issue is to do with Z-Location but rather some sort of COM weirdness within Win32-OpenSSH.
However, it would be nice to optionally disable that the Get-FrequentFolders function. Is that possible?
Other details:
- PowerShell Version: 7.3.6
- Windows Version: Windows 11 23H2 22631.2048
I've noticed that whenever I SSH into a Windows 11 host with Z-Location as part of the profile that it takes 2-3 minutes to load my profile.
I've narrowed it down to Z-Location. Then, still in SSH, I started a new instance of
pwsh -noprofileand manually ran the steps of theZLocation.psm1file to narrow down the slow part. The slow parts are:Get-FrequentFolders | ForEach-Object {Add-ZWeight -Path $_ -Weight 0}which takes 260 secondsGet-FrequentFoldersby itself takes 320 seconds$QuickAccess = New-Object -ComObject shell.applicationtakes 0.0022 seconds$QuickAccess.Namespace("shell:::{679f85cb-0220-4080-b29b-5540cc05aab6}")takes 0.012 seconds$QuickAccess.Namespace("shell:::{679f85cb-0220-4080-b29b-5540cc05aab6}").Items()takes 320 seconds(I'm aware I'm using a slightly older version of z-location but the content of the functions in question are not substantially different)
I've disabled the Get-FrequentFolders part of the powershell module on my remote host and now profile loading is almost instant again.
I don't think the root cause of this issue is to do with Z-Location but rather some sort of COM weirdness within Win32-OpenSSH.
However, it would be nice to optionally disable that the Get-FrequentFolders function. Is that possible?
Other details: