-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Enable Windows PowerShell PSModulePath by default on Windows #4132
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
Merged
daxian-dbw
merged 6 commits into
PowerShell:master
from
SteveL-MSFT:windows-psmodulepath
Jul 7, 2017
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8ff38c3
Default powershell host profile for Windows to append Windows PowerSh…
SteveL-MSFT 05d723b
Change test to use -noprofile to make output more predictable
SteveL-MSFT 1eb7b51
added tests, fixed typo
SteveL-MSFT 85b6401
added tests, fixed typo
SteveL-MSFT e6e064b
added -force to copy-item use
SteveL-MSFT 68b06c5
Merge branch 'windows-psmodulepath' of github.com:SteveL-MSFT/PowerSh…
SteveL-MSFT File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # Default profile for all users for PowerShell host | ||
|
|
||
| if ($IsWindows) | ||
| { | ||
| # Add Windows PowerShell PSModulePath to make it easier to discover potentially compatible PowerShell modules | ||
| # If a Windows PowerShell module works or not, please provide feedback at https://github.com/PowerShell/PowerShell/issues/4062 | ||
|
|
||
| Write-Warning "Appended Windows PowerShell PSModulePath" | ||
| $env:psmodulepath += ";${env:userprofile}\Documents\WindowsPowerShell\Modules;${env:programfiles}\WindowsPowerShell\Modules;${env:windir}\system32\WindowsPowerShell\v1.0\Modules\" | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This only gets the default, if the Windows PSModulePath is modified by installing Azure cmdlets or SQL, then they won't be available. We would need something like this:
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.
Calling out to Windows PowerShell can incur a 150-250ms startup penalty. Since this change isn't intended to be the final solution and just helps to get customer feedback, I think we are ok with it not being 100% accurate. Advanced customers can update their PSModulePath as needed.