Initialize-Module
1.5
It handles necessary prerequisites for PowerShell Gallery interaction, including:
- Setting the security protocol to TLS 1.2.
- Ensuring the NuGet package provider is available.
- Installing/updating and importing the 'Microsoft.PowerShell.PSResourceGet' module for
It handles necessary prerequisites for PowerShell Gallery interaction, including:
- Setting the security protocol to TLS 1.2.
- Ensuring the NuGet package provider is available.
- Installing/updating and importing the 'Microsoft.PowerShell.PSResourceGet' module for modern gallery operations.
For each module specified by the -Name parameter, the function will:
1. Attempt to install or update it to the latest version from the PowerShell Gallery. Modules are typically installed for AllUsers.
2. Import the module into the current session.
This automates the common tasks required to make PowerShell modules ready for use.
Installation Options
Owners
Package Details
Author(s)
- Jonathan Pitre
Tags
Dependencies
This script has no dependencies.
Release Notes
1.5 - 2025-01-27
- Added -AllowPrerelease switch parameter to enable installation of prerelease module versions.
- Enhanced Find-PSResource, Install-PSResource, and Update-PSResource calls to support prerelease versions when specified.
- Added verbose logging to indicate when prerelease versions are being searched for or installed.
1.4 - 2025-01-27
- Fixed version comparison error when Find-PSResource returns multiple module versions as an array.
- Added proper array handling to select the latest version when multiple versions are available.
- Improved error handling for cases where modules are not found in PSGallery repository.
1.3 - 2025-06-20
- Replaced Install-Module, Update-Module, and Get-Module commands with Install-PSResource, Update-PSResource, and Get-InstalledPSResource commands for improved performance and modern PowerShell Gallery interaction.
- Enhanced module management efficiency by leveraging the Microsoft.PowerShell.PSResourceGet module's optimized cmdlets.
- Fixed an error with the transcript file not being created on a fresh reboot.
1.2 - 2025-06-17
- Added error action silently continue to the Import-Module commands for Microsoft.PowerShell.PSResourceGet to avoid errors when the module is not installed.
1.1 - 2025-06-16
Added log file and transcript.
Added log path and file parameters.
1.0 - 2025-05-30
Initial release.
FileList
- Initialize-Module.nuspec
- Initialize-Module.ps1
Version History
Version | Downloads | Last updated |
---|---|---|
1.5 (current version) | 587 | 7/25/2025 |
1.3 | 506 | 6/20/2025 |
1.2 | 96 | 6/17/2025 |
1.1 | 19 | 6/17/2025 |
1.0 | 142 | 5/30/2025 |