-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add initial draft #388
base: master
Are you sure you want to change the base?
Add initial draft #388
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are many more comments and questions I want to add. But start with these changes.
As a user, | ||
I can customize the location of where PowerShell user content is installed, | ||
so that I can choose to sync with OneDrive. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a user, | |
I can customize the location of where PowerShell user content is installed, | |
so that I can choose to sync with OneDrive. | |
As a user, | |
I can customize the location where PowerShell user content is installed, | |
so that I can avoid problems created by file sync solutions like OneDrive. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
## Specification | ||
|
||
- This change will only apply to PowerShell on Windows. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why wouldn't we allow macOS and Linux users to relocate these files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So configurability for all platforms but moving default location only for windows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds reasonable to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
- 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- The PowerShell user content folder will be located in the AppData. | |
- The PowerShell user content folder will be located in the `"$env:LOCALAPPDATA\PowerShell"`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or should this be "$env:LOCALAPPDATA\Microsoft\PowerShell"
? The already use this location module cache and SecretManagement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$env:LOCALAPPDATA\Microsoft\PowerShell makes more sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should get @SteveL-MSFT feedback. I prefer to not create yet another PowerShell folder somewhere, but that folder get very full of files.
- The proposed directory structure: | ||
|
||
C:\Users\UserName\AppData\Local\PowerShell\ | ||
├── Modules (Configurable) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why aren't we allowing the location of the content folder to be changed? I want all my user files in one location, I don't want modules in one place and scripts/profiles in another.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. So only the location of the config file itself is not configurable and all other files is configurable through the config file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. So only the location of the config file itself is not configurable
Correct. Whether the other locations are configurable is open to discussion. My vision was that we would only allow configuration of the PSContentPath. Everything else would be in that location.
PSContentPath (configurable)
├── Scripts (Not Configurable)
├── Modules (Not Configurable)
├── Help (Not Configurable)
├── profile.ps1 (Not Configurable)
C:\Users\UserName\AppData\Local\PowerShell\ | ||
├── Modules (Configurable) | ||
├── Scripts (Not Configurable) | ||
├── Profiles (Not Configurable) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Profiles are currently in the root of the content folder. I am not against making a profiles subfolder, but is there a reason for this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant to make it a ps1 and not a directory.
{ | ||
"PSModulePath" : "C:\\Users\\chungjustin\\PowerShell" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PSModulePath
is already a value used in the config file. I suggest changing the name for this configuration to UserPSModulePath
. If we allow rehoming of the content folder then use UserPSContentPath
.
Use the suggested formatting.
{ | |
"PSModulePath" : "C:\\Users\\chungjustin\\PowerShell" | |
} | |
```json | |
{ | |
"PSModulePath" : "C:\\Users\\chungjustin\\PowerShell" | |
} | |
``` |
Question: Should setting PSModulePath
and the user paths be mutually exclusive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think making them not mutually exclusive is a good idea. And maybe even separating the scripts and profile out too?
{
"PSModulePath": "C:\Users\user\PowerShell",
"UserPSModulePath": "C:\Users\user\PowerShell",
"UserPSContentPath": "C:\Users\user\PowerShellContent"
"UserScriptPath": "C:\Users\user\PowerShellContent"
"UserProfilePath": "C:\Users\user\PowerShellContent"
}
## Alternate Proposals and Considerations | ||
|
||
- The following functionalities will be affected: | ||
- Secret Management. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to explain why this is a problem.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
- 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 | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix formatting
- 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 | |
``` | |
- 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 | |
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More comments
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
- The proposed directory structure: | ||
|
||
C:\Users\UserName\AppData\Local\PowerShell\ | ||
├── Modules (Configurable) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. So only the location of the config file itself is not configurable
Correct. Whether the other locations are configurable is open to discussion. My vision was that we would only allow configuration of the PSContentPath. Everything else would be in that location.
PSContentPath (configurable)
├── Scripts (Not Configurable)
├── Modules (Not Configurable)
├── Help (Not Configurable)
├── profile.ps1 (Not Configurable)
`$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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`$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. |
This pull request proposes a new RFC (RFC0066) to change the default location of PowerShell user content on Windows machines from OneDrive to the AppData directory. The goal is to align PowerShell with other developer tools and improve usability by preventing unnecessary syncing issues.
Key changes include:
PSModulePath
.