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 "-- Install-OriAzBopPrerequisity --"
    Write-Verbose "Name: $Name"
    Write-Verbose "Guid: $Guid"
    Write-Verbose "MaximumVersion: $MaximumVersion"
    Write-Verbose "RequiredVersion: $RequiredVersion"
    Write-Verbose "MinimumVersion: $MinimumVersion"
    Write-Verbose "PreRelease: $PreRelease"
    if ($SkipImport.IsPresent) {
        Write-Verbose "SkipImport: true"
    }
    else {
        Write-Verbose "SkipImport: false"
    }
    if ($AllowClobber.IsPresent) {
        Write-Verbose "AllowClobber: true"    
    }
    else {
        Write-Verbose "AllowClobber: false"           
    }
    if ($SkipPublisherCheck.IsPresent) {
        Write-Verbose "SkipPublisherCheck: true"    
    }
    else {
        Write-Verbose "SkipPublisherCheck: false"           
    }
    if ($AllowPrerelease.IsPresent) {
        Write-Verbose "AllowPrerelease: true"    
    }
    else {
        Write-Verbose "AllowPrerelease: false"           
    }
    
    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 "-- End of Install-OriAzBopPrerequisity --"
}