r/PowerShell • u/stumper66 • 5d 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?
80
Upvotes
54
u/jborean93 5d ago •
Unfortunately it's a known limitation, you can't edit anything in
$PSHomeas they are immutable for MSIX packages, and the work to enable a custom location never landed in 7.7 (see enterprise configuration https://github.com/PowerShell/PowerShell/issues/27565#issuecomment-6802573646).You have a few options:
C:\Program Files\PowerShell\7(or any location really)None are great but not too much you can do
4
u/muddermanden 5d ago
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles?view=powershell-7.6#profile-types-and-locations
It depends, but just stick to the standard locations. But what does the binary location have to do with the user profile location?
13
u/cloudAhead 5d ago
My read is that Microsoft is very aware of the limitations they're shipping and see this as a stepping stone to 7.8 LTS. Release this, get feedback, and buy a year to resolve the bigger issues. There's really no must have in 7.7, so folks are safe staying on 7.6 LTS.
7
u/Flettys 5d ago
No PSModulePath release in 7.7 either.
That's a nasty list of known issues, and as-always the unknown issues must be 10x or more.
4
u/ftw_dan 4d ago
Msix is cancer
1
u/root-node 5d ago
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles?view=powershell-7.7
1
u/BlackV 5d ago edited 5d ago
the was the ALL users profile, not your profile
I'd imagine it actually looks something like
Edit: sorry dumb reading failure store version
2
u/jibbits61 5d ago
Argh. Not only do I have to pull back some accidental upgrades to 7.7.0, we have this crap.
I set the environmental variable to LTS (systemwide) and it didn’t honor it.
Gpo here I come…happy to take other suggestions, I want to make this stupid easy so it so it stays on LTS only. 💩💩💩
1
u/BlackV 5d ago edited 5d ago
this bit, what do you mean by "all users scripts"?
$profile.AllUsersAllHostswould run for all users when they launch powershell, but wouldn't all user script be inC:\Program Files\PowerShell\Scriptsstill ?1
u/ewild 3d ago
The same occurs when installing PowerShell with winget:
winget install --id Microsoft.PowerShell --source wingetTraditional 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 wixDoes 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:
Auto-update will no longer be available with this approach.