r/PowerShell • • 20d ago

Question PowerShell 7.7 - All users profile script location

Starting with PowerShell 7.7 it is now a windows app and if you install it with Add-AppxPackage, then it will live in "C:\Program Files\WindowsApps\Microsoft.PowerShell_7.7.0.0_x64__8wekyb3d8bbwe"

On previous versions I had profile.ps1 live in "C:\Program Files\PowerShell\7"
However not only do I suspect the bin directory will change with each new version, it is now read-only for everything except system, you can't put any files in there without hacking it with system privileges.
Where do they expect us to put all user scripts now?

82 Upvotes

24 comments sorted by

View all comments

1

u/ewild 18d ago

The same occurs when installing PowerShell with winget:

winget install --id Microsoft.PowerShell --source winget

Traditional installation of the latest PowerShell via winget is no longer possible (the MSI installer is no longer provided, so the command below installs 7.6.10 max, not 7.7.0):

winget install --id Microsoft.PowerShell --source winget --installer-type wix

Does it make sense now to install 7.6.10 and then update it with PowerShell-7.7.0-win-x64.zip (and with PowerShell-7.*-win-x64.zip on)?

Installing 7.7.0 this way (7.6.10 > zip > 7.7.0) gives:

$profile | select *
AllUsersAllHosts       : C:\Program Files\PowerShell\7\profile.ps1
AllUsersCurrentHost    : C:\Program Files\PowerShell\7\Microsoft.PowerShell_profile.ps1
CurrentUserAllHosts    : <OneDrive>\Documents\PowerShell\profile.ps1
CurrentUserCurrentHost : <OneDrive>\Documents\PowerShell\Microsoft.PowerShell_profile.ps1

Auto-update will no longer be available with this approach.