en-US/about_SpecModuleImporter.help.txt

TOPIC
    about_SpecModuleImporter
 
SHORT DESCRIPTION
    A module that assists with the importing of PowerShell modules from the PSGallery
 
LONG DESCRIPTION
    This module can assist with the installation and importing of modules from the PSGallery.
    - You are able to specify a particular verions number to install, or you can install the latest version.
    - You are able to import as specific module version even though multiple versions are installed.
 
EXAMPLES
# Check if the SpecModuleImporter module is installed
if (-not (Get-Module -ListAvailable | Where-Object {$_.Name -eq "SpecModuleImporter"})) {
    # Module is not installed, so install it from the PowerShell Gallery
    Write-Host "Module 'SpecModuleImporter' is not installed. Installing..."
    Install-Module -Name "SpecModuleImporter" -Force -Scope CurrentUser
    Write-Host "Module 'SpecModuleImporter' has been installed."
}
else {
    Write-Host "Module 'SpecModuleImporter' is already installed."
}
 
# Install a specific version of a module. (If you want the latest version set RequiredVersion = "")
 
$Modules = @(
    @{
        moduleName = 'SpecBaseModule'
        requiredVersion = "1.0.2"
 
    },
    @{
        moduleName = 'Az.Accounts'
        requiredVersion = '2.10.2'
    }
)
 
#install modules if required
$modules | % { Install-SpecPowerShellModule -Module $_.moduleName -RequiredVersion $_.requiredVersion -Scope CurrentUser -Verbose}
 
#Import the specified version of the module
$modules | % { Import-SpecPowerShellModule -Module $_['moduleName'] -RequiredVersion $_['requiredVersion'] -Verbose }
 
 
 
KEYWORDS
 
 
SEE ALSO