From 828a9810212c0eb6daa4f3ad4812fe81dd0ec307 Mon Sep 17 00:00:00 2001 From: Justin Chung Date: Thu, 3 Apr 2025 12:38:14 -0500 Subject: [PATCH 1/6] Add initial draft --- .../RFC0066-PowerShell-User-Content-Location | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 Draft-Accepted/RFC0066-PowerShell-User-Content-Location diff --git a/Draft-Accepted/RFC0066-PowerShell-User-Content-Location b/Draft-Accepted/RFC0066-PowerShell-User-Content-Location new file mode 100644 index 00000000..eb8e4927 --- /dev/null +++ b/Draft-Accepted/RFC0066-PowerShell-User-Content-Location @@ -0,0 +1,66 @@ +--- +RFC: RFC0066 +Author: Justin Chung +Status: Draft +SupercededBy: N/A +Version: 1.0 +Area: Core +Comments Due: 6/30/2022 +Plan to implement: Yes +--- + +# PowerShell User Content Location + +This RFC proposes moving the current PowerShell user content location out of OneDrive to the AppData directory on Windows machines. + +## Motivation + +- PowerShell currently places profile, modules, and configuration files in the user's Documents folder, which is against established conventions for shell configurations and tools. +- PowerShell content files in OneDrive causes unnecessary syncing of configuration files, leading to various issues. +- There is strong community demand for changing this behavior as the current setup is problematic for many users. +- Changing the default location would align PowerShell with other developer tools and improve usability. + + As a user, + I can customize the location of where PowerShell user content is installed, + so that I can choose to sync with OneDrive. + +## User Experience + +- On startup PowerShell will create a directory in AppData and a configuration file. +- In the configuration file the user scoped PSModulePath will point to AppData/PowerShell/Modules. +- Users can opt out of this new location by specifying a desired user scoped module path in the configuration file. + +## Specification + +- This change will only apply to PowerShell on Windows. +- This will be an experimental feature. +- The PowerShell user content folder will be located in the AppData. +- A configuration file in the PowerShell user content folder will determine the location of the user scoped PSModulePath. +- The user will be responsible for specifying thier desired install location using PSResourceGet. +- The location of Modules is configurable +- The location of this folder is not configurable. +- The proposed directory structure: + + C:\Users\UserName\AppData\Local\PowerShell\ + ├── Modules (Configurable) + ├── Scripts (Not Configurable) + ├── Profiles (Not Configurable) + └── PSModulePathConfig.json (Not Configurable) + +- The proposed json file: + + { + "PSModulePath" : "C:\\Users\\chungjustin\\PowerShell" + } + +## Alternate Proposals and Considerations + +- The following functionalities will be affected: + - Secret Management. +- Use the following script to relocate the PowerShell contents folder: + +```pwsh +$newPath = "C:\Custom\PowerShell\Modules" +$currentUserModulePath = [System.Environment]::GetFolderPath('MyDocuments') + "\PowerShell\Modules" +Move-Item -Path $currentUserModulePath -Destination $newPath -Force +``` From 9901f90696a70ebde6da39333fcd649134228ede Mon Sep 17 00:00:00 2001 From: Justin Chung Date: Thu, 3 Apr 2025 13:22:37 -0500 Subject: [PATCH 2/6] Fix date --- Draft-Accepted/RFC0066-PowerShell-User-Content-Location | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Draft-Accepted/RFC0066-PowerShell-User-Content-Location b/Draft-Accepted/RFC0066-PowerShell-User-Content-Location index eb8e4927..66a33fb3 100644 --- a/Draft-Accepted/RFC0066-PowerShell-User-Content-Location +++ b/Draft-Accepted/RFC0066-PowerShell-User-Content-Location @@ -5,7 +5,7 @@ Status: Draft SupercededBy: N/A Version: 1.0 Area: Core -Comments Due: 6/30/2022 +Comments Due: 05/03/2025 Plan to implement: Yes --- From e9808dce41efef810c040342a16a6cc7e8a9c5a5 Mon Sep 17 00:00:00 2001 From: Justin Chung Date: Thu, 3 Apr 2025 14:34:19 -0500 Subject: [PATCH 3/6] Reword motivation and specification --- Draft-Accepted/RFC0066-PowerShell-User-Content-Location | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Draft-Accepted/RFC0066-PowerShell-User-Content-Location b/Draft-Accepted/RFC0066-PowerShell-User-Content-Location index 66a33fb3..11bd5321 100644 --- a/Draft-Accepted/RFC0066-PowerShell-User-Content-Location +++ b/Draft-Accepted/RFC0066-PowerShell-User-Content-Location @@ -16,7 +16,7 @@ This RFC proposes moving the current PowerShell user content location out of One ## Motivation - PowerShell currently places profile, modules, and configuration files in the user's Documents folder, which is against established conventions for shell configurations and tools. -- PowerShell content files in OneDrive causes unnecessary syncing of configuration files, leading to various issues. +- PowerShell content files in OneDrive can lead to unwanted syncing of module files, leading to various issues. - There is strong community demand for changing this behavior as the current setup is problematic for many users. - Changing the default location would align PowerShell with other developer tools and improve usability. @@ -47,7 +47,7 @@ This RFC proposes moving the current PowerShell user content location out of One ├── Profiles (Not Configurable) └── PSModulePathConfig.json (Not Configurable) -- The proposed json file: +- The configuration file: { "PSModulePath" : "C:\\Users\\chungjustin\\PowerShell" From 60ee0ab0228f76a9739a88cb2f5fcd7627bb74d5 Mon Sep 17 00:00:00 2001 From: Justin Chung Date: Fri, 4 Apr 2025 11:47:11 -0500 Subject: [PATCH 4/6] Edits from first revision --- .../RFC0066-PowerShell-User-Content-Location | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/Draft-Accepted/RFC0066-PowerShell-User-Content-Location b/Draft-Accepted/RFC0066-PowerShell-User-Content-Location index 11bd5321..05d9152a 100644 --- a/Draft-Accepted/RFC0066-PowerShell-User-Content-Location +++ b/Draft-Accepted/RFC0066-PowerShell-User-Content-Location @@ -21,8 +21,8 @@ This RFC proposes moving the current PowerShell user content location out of One - Changing the default location would align PowerShell with other developer tools and improve usability. As a user, - I can customize the location of where PowerShell user content is installed, - so that I can choose to sync with OneDrive. + I can customize the location where PowerShell user content is installed, + so that I can avoid problems created by file sunc solutions like OneDrive. ## User Experience @@ -32,9 +32,10 @@ This RFC proposes moving the current PowerShell user content location out of One ## Specification -- This change will only apply to PowerShell on Windows. +- The content folder location change will only apply to PowerShell on Windows. +- Configurability of the content folder will apply to all systems. - This will be an experimental feature. -- The PowerShell user content folder will be located in the AppData. +- The PowerShell user content folder will be located in the `$env:LOCALAPPDATA\Microsoft\PowerShell`. - A configuration file in the PowerShell user content folder will determine the location of the user scoped PSModulePath. - The user will be responsible for specifying thier desired install location using PSResourceGet. - The location of Modules is configurable @@ -43,24 +44,29 @@ This RFC proposes moving the current PowerShell user content location out of One C:\Users\UserName\AppData\Local\PowerShell\ ├── Modules (Configurable) - ├── Scripts (Not Configurable) - ├── Profiles (Not Configurable) + ├── Scripts (Configurable) + ├── profile.ps1 (Configurable) └── PSModulePathConfig.json (Not Configurable) - The configuration file: - { - "PSModulePath" : "C:\\Users\\chungjustin\\PowerShell" - } + ```json + { + "UserPSContentPath" : "C:\\Users\\User\\PowerShell" + } + ``` ## Alternate Proposals and Considerations - The following functionalities will be affected: - - Secret Management. + - SecretManagement + - SecretManagement extension vaults are registered for the current user context in: + `$env:LOCALAPPDATA\Microsoft\PowerShell\secretmanagement\secretvaultregistry\` + When an extension vault is registered, SecretManagement stores the full path to the extension module in the registry. Moving the PowerShell content to a new location will break the vault registrations. - Use the following script to relocate the PowerShell contents folder: -```pwsh -$newPath = "C:\Custom\PowerShell\Modules" -$currentUserModulePath = [System.Environment]::GetFolderPath('MyDocuments') + "\PowerShell\Modules" -Move-Item -Path $currentUserModulePath -Destination $newPath -Force -``` + ```pwsh + $newPath = "C:\Custom\PowerShell\Modules" + $currentUserModulePath = [System.Environment]::GetFolderPath('MyDocuments') + "\PowerShell\Modules" + Move-Item -Path $currentUserModulePath -Destination $newPath -Force + ``` \ No newline at end of file From 95798e03ffc0d710ab2722bf53f4466d3c024515 Mon Sep 17 00:00:00 2001 From: Justin Chung Date: Mon, 7 Apr 2025 13:15:36 -0500 Subject: [PATCH 5/6] Edits from second revision --- .../RFC0066-PowerShell-User-Content-Location | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/Draft-Accepted/RFC0066-PowerShell-User-Content-Location b/Draft-Accepted/RFC0066-PowerShell-User-Content-Location index 05d9152a..dcb776c7 100644 --- a/Draft-Accepted/RFC0066-PowerShell-User-Content-Location +++ b/Draft-Accepted/RFC0066-PowerShell-User-Content-Location @@ -22,7 +22,7 @@ This RFC proposes moving the current PowerShell user content location out of One As a user, I can customize the location where PowerShell user content is installed, - so that I can avoid problems created by file sunc solutions like OneDrive. + so that I can avoid problems created by file sync solutions like OneDrive. ## User Experience @@ -43,10 +43,14 @@ This RFC proposes moving the current PowerShell user content location out of One - The proposed directory structure: C:\Users\UserName\AppData\Local\PowerShell\ - ├── Modules (Configurable) - ├── Scripts (Configurable) - ├── profile.ps1 (Configurable) - └── PSModulePathConfig.json (Not Configurable) + ├── PSContent (Configurable) + └── PSModulePathConfig.json (Not Configurable) + + PSContent (Configurable) + ├── Scripts (Not Configurable) + ├── Modules (Not Configurable) + ├── Help (Not Configurable) + └── profile.ps1 (Not Configurable) - The configuration file: @@ -61,8 +65,11 @@ This RFC proposes moving the current PowerShell user content location out of One - The following functionalities will be affected: - SecretManagement - SecretManagement extension vaults are registered for the current user context in: - `$env:LOCALAPPDATA\Microsoft\PowerShell\secretmanagement\secretvaultregistry\` - When an extension vault is registered, SecretManagement stores the full path to the extension module in the registry. Moving the PowerShell content to a new location will break the vault registrations. + `$env:LOCALAPPDATA\Microsoft\PowerShell\secretmanagement\secretvaultregistry\` + + When an extension vault is registered, SecretManagement stores the full path to the extension + module in the registry. Moving the PowerShell content to a new location will break the vault + registrations. - Use the following script to relocate the PowerShell contents folder: ```pwsh From f35150d8aaefea8711c3550d989921ebea51cbb8 Mon Sep 17 00:00:00 2001 From: Justin Chung Date: Tue, 8 Apr 2025 15:09:17 -0500 Subject: [PATCH 6/6] Added .md extension --- ...ent-Location => RFC0066-PowerShell-User-Content-Location.md} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename Draft-Accepted/{RFC0066-PowerShell-User-Content-Location => RFC0066-PowerShell-User-Content-Location.md} (99%) diff --git a/Draft-Accepted/RFC0066-PowerShell-User-Content-Location b/Draft-Accepted/RFC0066-PowerShell-User-Content-Location.md similarity index 99% rename from Draft-Accepted/RFC0066-PowerShell-User-Content-Location rename to Draft-Accepted/RFC0066-PowerShell-User-Content-Location.md index dcb776c7..50d9fbe1 100644 --- a/Draft-Accepted/RFC0066-PowerShell-User-Content-Location +++ b/Draft-Accepted/RFC0066-PowerShell-User-Content-Location.md @@ -76,4 +76,4 @@ This RFC proposes moving the current PowerShell user content location out of One $newPath = "C:\Custom\PowerShell\Modules" $currentUserModulePath = [System.Environment]::GetFolderPath('MyDocuments') + "\PowerShell\Modules" Move-Item -Path $currentUserModulePath -Destination $newPath -Force - ``` \ No newline at end of file + ```