Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/JustinGrote/ModulePath
PowerShell Module to get and set the primary PSModulePath config
https://github.com/JustinGrote/ModulePath
Last synced: 22 days ago
JSON representation
PowerShell Module to get and set the primary PSModulePath config
- Host: GitHub
- URL: https://github.com/JustinGrote/ModulePath
- Owner: JustinGrote
- License: other
- Created: 2024-09-11T06:02:15.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2024-09-13T15:49:03.000Z (about 2 months ago)
- Last Synced: 2024-09-14T06:44:53.761Z (about 2 months ago)
- Language: PowerShell
- Homepage:
- Size: 12.7 KB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- License: LICENSE.MD
Awesome Lists containing this project
- jimsghstars - JustinGrote/ModulePath - PowerShell Module to get and set the primary PSModulePath config (PowerShell)
README
# ModulePath
This module can be used to get and set the new [PSModulePath Config Setting in PowerShell 7](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_powershell_config?view=powershell-7.4#psmodulepath), which allows you to set your PSModulePath default directory. This is useful for targeting modules outside of OneDrive.
Please note that `PSGet/PSResourceGet` do not have native support for this new directory, and you will need to use Save-Module/Save-PSResource instead of Install-Module/Install-PSResource. As an alternative, consider [ModuleFast](https://github.com/justingrote/modulefast) which has native support and detection for powershell.config.json.
## Quick Start
```powershell
#Returns nothing if your powershell.config.json has not been configured yet
Get-ModulePathConfig#Preview setting the module path to this, optionally creating it if it doesn't exist.
Set-ModulePathConfig -Path '%LOCALAPPDATA%\powershell\Modules' -Whatif#Apply the setting. Optionally specify -AllUsers to specify it at the PowerShell level (usually requires admin rights unless powershell is locally installed into your users directory)
Set-ModulePathConfig -Path '%LOCALAPPDATA%\powershell\Modules' # Sets the module path for the user#Gets your current active primary PSModulePath. Note that a restart of PowerShell is required for the above to take effect.
Get-ModulePath
Get-ModulePath -AllUsers
```