Repository navigation
Some cmdlets and config require writing to $PSHOME\SessionConfig folder #9278
Description
Summary of the new feature/enhancement
For Snap and AppX packages of PSCore6, $PSHOME is effectively read-only. Any configuration stored in $PSHOME needs to be in a different location. On Windows 10, it would make sense to be in $env:SystemDrive\ProgramData.
Register-PSSessionConfiguration stores the config file in $PSHOME\SessionConfig folder.
powershell.config.json for the system is stored in $PSHOME, this means that admins can't set system wide config and cmdlets like Enable-ExperimentalFeature -Scope AllUsers won't work.
Update-Help -Scope AllUsers also won't work as it's stored in $PSHOME.
When this is fixed, test changes relying on Test-CanWriteToPsHome should be reverted.
Update — scope narrowed; solved via the MachineFolder data store
The pieces this issue originally enumerated are now split up:
- System-wide
powershell.config.jsonandEnable/Disable-ExperimentalFeature -Scope AllUsers→ handled by the config relocation: design [Design] MachineFolder: a per-machine writable data store for MSIX-packaged PowerShell #27697, implementation PR Place System-Wide Config in the Machine Folder for MSIX Packages #27632. Update-Help -Scope AllUsers→ now tracked in PS7-packaged: Update-Help -Scope AllUsers fails under MSIX ($PSHOME read-only) #27699.Test-CanWriteToPsHometest reverts → revisited as each piece lands.
This issue is narrowed to the SessionConfig .pssc write-location: Register/Set-PSSessionConfiguration copy the .pssc into $PSHome\SessionConfig (Utils.DefaultPowerShellAppBase, CustomShellCommands.cs:950), which is read-only under MSIX. The fix mirrors the profile relocation — Utils.GetPackagedMachineDataStorePath() ?? AppBase + \SessionConfig.
WinRM / remoting activation under MSIX (native pwrshplugin.dll registration) remains a separate concern tracked in #27563. Tracked under #27565.
Activity
[-]Register-PSSessionConfiguration requires writing to $PSHOME\SessionConfig folder[/-][+]Some cmdlets and config require writing to $PSHOME\SessionConfig folder[/+]iSazonov commentedon Apr 28, 2019
Long time Windows exposes UAC virtualization for registry keys and file system.
If we could use it it would solve this problem.
SteveL-MSFT commentedon Apr 29, 2019
Ilya (@iSazonov) that would potentially work for Windows, but doesn't solve the same problem with Snaps.
iSazonov commentedon Apr 30, 2019
I like the way for Windows. I think it is right way.
I guess there is a solution in Snaps too - PowerShell is not single application with such behavior. My quick search https://forum.snapcraft.io/t/snap-layouts/7207 "Creating new files and directories in read-only spaces". So I believe Snaps has that we need.
TravisEz13 commentedon May 6, 2019
What parts of snap would we map? Just because we can, doesn't mean we should. We should not make any part of $PSHome writable on linux.
bcdady commentedon Jun 11, 2019
See also https://github.com/PowerShell/PowerShell-Snap/issues/32
joeyaiello commentedon Jul 8, 2019
Can we just use
/etc/for this? Or does Snap "classic" et al not have a way to do this?TravisEz13 commentedon Jul 9, 2019
Joey Aiello (@joeyaiello) The problem is this should be done in PowerShell.
/etcis where the file should be for all PowerShell installations.iSazonov commentedon Jul 12, 2019
For reference #4080
TravisEz13 commentedon Nov 4, 2019
Known locations that write into $PSHOME - In-progress
Register-PSSessionConfiguration$PSHOME\SessionConfigUpdate-Help -scope currentuser$pshome\powershell.config.jsonYes (buggy #7452)Update-Help -scope AllUsers$PSHome\en-USEnable-ExperimentalFeature -Scope AllUsers$pshome\powershell.config.jsonSet-ExecutionPolicy -Scope LocalMachine$pshome\powershell.config.jsonTravisEz13 commentedon Nov 4, 2019
Proposal
Rational
It looks like the majority of the problem is writing to the configuration file. We should move it under
/etcfor Linux and macOS, and `%programdata% for Windows.We can make similar changes for
$PSHome\SessionConfigand$PSHome\en-US(and related folders) later.Details
Security
These folders should be secured similarly to the currently location the file is located at when the product is installed via DEB, RPM, or MSI.
The configuration file is system wide configuration and only system administrators should be able to modify it. This also eliminates pwsh creating it on first launch.
Linux and macOS
We would move the system configuration to
/etc/powershell/powershell.config.jsonWe would use the folder so that any addition items will be group together.
Packages would have to be updated to create this and the zip instruction would have to be update or a script created.
Windows
We would move the system configuration to
%programdata%\Microsoft\PowerShell\powershell.config.jsonMSI could be update to create the file.
MSIX - Steve Lee (@SteveL-MSFT)?
zip - instructions would have to be updated
Issues
SteveL-MSFT commentedon Nov 4, 2019
For PowerShell.config.json, it might be better to have cmdlet(s) to manage that file with
-Scope AllUsers/CurrentUser. This would work cross-platform.41 remaining items
lafe commentedon Nov 13, 2025
I encountered this issue with the
Set-ExecutionPolicyCmdlet just this week. So from my point of view, it's still relevant.ssg commentedon Mar 24, 2026
I'm having the problem of not being able to
Set-ExecutionPolicybecause it tries to modifypowershell.config.jsonin the Appx installation directory. This happens on an Administrator Powershell prompt:ssg commentedon Mar 24, 2026
Steve Lee (@SteveL-MSFT) marked the original bug as duplicate, now we're left at the mercy of triage for this issue marked as "Issue-Enhancement". It feels like an obvious bug to me at the moment, regression even.
This keeps happening on pwsh 7.6.0 installed from MSStore.
SteveL-MSFT commentedon May 12, 2026
https://learn.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-desktop8-mutablepackagedirectory might be a way to address this
DrusTheAxe commentedon May 15, 2026
Better answer is ApplicationData's MachineFolder
https://github.com/microsoft/WindowsAppSDK/blob/main/specs/applicationdata/ApplicationData.md#342-manifested-opt-in
TL;DR in
AppxManifest.xmldeclare "I want a per-machine (machine-wide-accessible) data location".<appdata:ApplicationData><MachineFolder/>inAppxManifest.xml. Add the Sddl=... attribute needed to grant additional permissionsApplicationData provides per-packagefamily per-user data storage.
ApplicationData.MachineFolder provides per-packagefamily per-machine data storage.
DrusTheAxe commentedon May 15, 2026
By design. MSIX package's install location is not Writeable; Read (and eXecute) rights only. Else it would break MSIX's security and integrity promises, and preclude data efficiencies (e.g. shared by all users, not a unique copy/disk-space per user).
Some unpackaged apps use the classic pattern of "store config file next to app and modify the config file as/when desired". Powershell is one such example.
MSIX recommends storing an original/unmodified/template file in the package and storing an override file in a mutable location e.g. ApplicationData.LocalPath for per-user storage, or ApplicationData.MachinePath for per-machine storage. Then at runtime instead of the classic
use the override pattern e.g.
ssg commentedon May 15, 2026
So, is it a bug with
Set-ExecutionPolicy?DrusTheAxe commentedon May 15, 2026
That would be a fair characterization.
The rules for packaged and unpackaged processes aren't identical. This is one such example.
One can make an application run in both contexts e.g. use override file if running with package identity. It's up the the app/dev to decide if this is warranted for their needs.