Install-RequiredModule

5.1.0-upgrade0007

Parses a RequiredModules.psd1 listing modules and attempts to import those modules.
If it can't find the module in the PSModulePath, attempts to install it from PowerShellGet.

The RequiredModules list looks like this (uses nuget version range syntax, and now, has an optional syntax for specifying the repository to install from):
@{
   "PowerShellGet" = "2.0.4"
   "
Parses a RequiredModules.psd1 listing modules and attempts to import those modules.
If it can't find the module in the PSModulePath, attempts to install it from PowerShellGet.

The RequiredModules list looks like this (uses nuget version range syntax, and now, has an optional syntax for specifying the repository to install from):
@{
   "PowerShellGet" = "2.0.4"
   "Configuration" = "[1.3.1,2.0)"
   "Pester"        = "[4.4.2,4.7.0]"
   "ModuleBuilder"    = @{
       Version = "2.*"
       Repository = "https://www.powershellgallery.com/api/v2"
   }
}

https://docs.microsoft.com/en-us/nuget/reference/package-versioning#version-ranges-and-wildcards

Show more
This is a prerelease version of Install-RequiredModule.
There is a newer prerelease version of this script available.
See the version list below for details.

Installation Options

Copy and Paste the following command to install this package using PowerShellGet More Info

Install-Script -Name Install-RequiredModule -RequiredVersion 5.1.0-upgrade0007 -AllowPrerelease

Copy and Paste the following command to install this package using Microsoft.PowerShell.PSResourceGet More Info

You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deploy all the dependencies to Azure Automation. Learn More

Manually download the .nupkg file to your system's default download location. Note that the file won't be unpacked, and won't include any dependencies. Learn More

Owners

Copyright

Copyright (c) 2020 Joel Bennett

Package Details

Author(s)

  • Joel 'Jaykul' Bennett

Tags

Install Requirements Development Dependencies Modules

Dependencies

This script has no dependencies.

Release Notes

5.1.0 (preview)
SORTING
- Add Optimize-Dependency, and use it to make sure we install dependencies in order
UPGRADE
- Add -Upgrade to allow searching for newer versions of installed modules while still enforcing the version range
- Includes a warning when in -Upgrade mode, if there is a newer version that will not be installed because of the version range
MISC
- Finally got around to writing more tests. Fixed stuff that did not work as expected
5.0.5 Fix the -Destination parameter
5.0.2 Fix a bug with PowerShellGet 1.0.0.1
5.0.1 Fix PowerShell 5 .Where bug again (sorry)
5.0.0 Available as a module, with multiple repository support
BREAKING CHANGES:
- No longer automatically trusts PSGallery. You must ensure that there is at least one repository registered and trusted, or use the `-TrustRegisteredRepositories` to trust all repositories.
- Allows installing from any trusted repository. There is also new syntax for the RequiredModules hashtables to support specifying a specific repository for any specific module. See the ReadMe or the help for Install-RequiredModule.
MAJOR IMPROVEMENTS:
- Supports passing the RequiredModules hashtable directly on the commandline, rather than requiring a file.
- Also available in the "RequiredModules" module
By default, we only install from trusted repositories. You should mark the repositories you regularly install from as trusted repositories. See the following example to trust the default PSGallery:
Register-PSRepository -Default -ErrorAction Ignore -InstallationPolicy Trusted
Get-PSRepository -Name PSGallery | Set-PSRepository -InstallationPolicy Trusted
4.1.1 Minor fixes for edge cases and options
4.1.0 Support non-PSGallery feeds
4.0.6 Fix a double -Verbose problem
4.0.5 Let the -Destination be non-empty (so we do not have to re-download every time)
4.0.4 Fix PowerShell 5 .Where bug
4.0.3 Fix module check when using -Destination to force all modules to be in destination
4.0.2 Fix Remove-Module error
4.0.1 Add logging outputs
4.0.0 BREAKING CHANGE: require the -Destination to start empty (allow -CleanDestination to clear it)
Fix for adding the destination to PSModulePath multiple times
Started testing this so I can ship it to PowerShellGet
3.0.0 BREAKING CHANGE: switch -SkipImport to -Import -- inverting the logic to NOT import by default
Add -Destination parameter to support installing in a local tool path
2.0.1 Squash mistaken "InstallError" message caused by Select-Object -First
Clean up output that was unexpected
2.0.0 BREAKING CHANGE: use NuGetVersion to support wildcards like 3.*
Improve the error messages around aborted or failed installs
1.0.1 Fix "Version 3.4.0 of module Pester is already installed"
1.0.0 This is the first public release - it probably does not work right

FileList

Version History

Version Downloads Last updated
5.1.2 2,853 8/20/2024
5.1.0 3,672 5/16/2024
5.1.0-upgrad... 325 9/22/2022
5.1.0-upgrad... 13 9/22/2022
5.1.0-upgrad... (current version) 19 9/14/2022
5.1.0-upgrad... 15 9/14/2022
5.0.5 42,553 9/3/2022
5.0.2 6,477 12/2/2021
5.0.1 20 12/2/2021
5.0.0 44 12/1/2021
4.0.6 50,613 6/4/2019
4.0.5 62 5/15/2019
4.0.4 87 4/27/2019
4.0.3 26 4/27/2019
4.0.2 37 4/27/2019
4.0.1 26 4/27/2019
4.0.0 33 4/24/2019
3.0.0 40 3/22/2019
2.0.1 27 3/21/2019
2.0.0 33 3/21/2019
1.0.1 29 3/21/2019
1.0.0 29 3/20/2019
Show more