Public/Install-OriAzBopPrerequisity.ps1

<#
.SYNOPSIS
    Install modules required from PSGallery
.DESCRIPTION
    Install modules required from PSGallery
 
.PARAMETER Name
    Specifies the exact names of modules to install from the online gallery. The module name must match the module name in the repository.
 
.PARAMETER Guid
    GUID of the mmodule
 
.PARAMETER MaximumVersion
    Maximum module version
 
.PARAMETER RequiredVersion
    Required module version
 
.PARAMETER Version
    Most likely minimum module version
 
.PARAMETER PreRelease
    Name of PreRelease
     
.PARAMETER SkipImport
    When is set Import-Module will be skipped
 
.PARAMETER AllowClobber
    When is set AllowClobber will be used
 
.PARAMETER SkipPublisherCheck
    When is set SkipPublisherCheck will be used
 
.PARAMETER SkipPublisherCheck
    When is set SkipPublisherCheck will be used
 
.PARAMETER AllowPrerelease
    When is set AllowPrerelease will be used
     
.EXAMPLE
    Install-OriAzBopPrerequisity -Name PowerShellGet -MinimumVersion 2.2.3
#>

function Install-OriAzBopPrerequisity {
    [CmdLetBinding()]
    param (
        [Parameter(Mandatory = $true, HelpMessage = "Exact name of the module")]
        [String] $Name,

        [Parameter(Mandatory = $false, HelpMessage = "GUID of the mmodule")]
        [string] $Guid,
    
        [Parameter(Mandatory = $false, HelpMessage = "Maximum module version")]
        [Version] $MaximumVersion,
    
        [Parameter(Mandatory = $false, HelpMessage = "Required module version")]
        [Version] $RequiredVersion,
    
        [Parameter(Mandatory = $false, HelpMessage = "Minimum module version")]
        [Alias('Version')]
        [Version] $MinimumVersion,

        [Parameter(Mandatory = $false, HelpMessage = "Name of PreRelease")]
        [String] $PreRelease,        

        [Parameter(Mandatory = $false, HelpMessage = "When is set import-module will be skipped.")]
        [switch] $SkipImport,

        [Parameter(Mandatory = $false, HelpMessage = "When is set AllowClobber will be used.")]
        [switch] $AllowClobber,
        
        [Parameter(Mandatory = $false, HelpMessage = "When is set SkipPublisherCheck will be used.")]
        [switch] $SkipPublisherCheck,
        
        [Parameter(Mandatory = $false, HelpMessage = "When is set AllowPrerelease will be used.")]
        [switch] $AllowPrerelease
    )
    $ErrorActionPreference = 'Stop'
    Write-Verbose -Message ("[ START: {0}:{1} (v.{2}) ]" -f $Local:MyInvocation.MyCommand.Source, $Local:MyInvocation.MyCommand.Name, $Local:MyInvocation.MyCommand.Version)
    foreach ($arg in $PSBoundParameters.GetEnumerator()) {
        if ([string]::IsNullOrEmpty($arg.Value)) {
            Write-Debug -Message ("[null] {0}: {1}" -f $arg.Key, $arg.Value) -ErrorAction SilentlyContinue 
        }
        else {
            Write-Debug -Message ("[{2}] {0}: {1}" -f $arg.Key, $arg.Value, $arg.Value.GetType().Name) -ErrorAction SilentlyContinue 
        }
    }
    
    Install-OriAzBopPrerequisite `
        -Name $Name `
        -Guid $Guid `
        -MaximumVersion $MaximumVersion `
        -RequiredVersion $RequiredVersion `
        -MinimumVersion $MinimumVersion `
        -PreRelease $PreRelease `
        -SkipImport:$SkipImport `
        -AllowClobber:$AllowClobber `
        -SkipPublisherCheck:$SkipPublisherCheck `
        -AllowPrerelease:$AllowPrerelease `
        -Verbose:$VerbosePreference `
        -Debug:$DebugPreference


    
    Write-Verbose -Message ("[ END: {0} ]" -f $Local:MyInvocation.MyCommand.Name)
}