private/Install-MSP360Module.ps1

function Install-MSP360Module {
    [CmdletBinding()]
    param (
        [Parameter()]
        [bool]
        $AllowAlpha
    )

    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    if ($Host.Version.Major -ge 5){
        Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
    }else{
        Add-Type -AssemblyName System.IO.Compression.FileSystem -ErrorAction Stop
        @("PackageManagement","PowerShellGet") | ForEach-Object {
            if(-not (get-module $_ -ListAvailable)){
                (New-Object Net.WebClient).DownloadFile("https://www.powershellgallery.com/api/v2/package/$_", "$ENV:TEMP\$_.zip")
                $InstallFolder = New-Item -Path "$ENV:windir\System32\WindowsPowerShell\v1.0\Modules" -Name $_ -ItemType "directory" -ErrorAction SilentlyContinue
                [System.IO.Compression.ZipFileExtensions]::ExtractToDirectory(([System.IO.Compression.ZipFile]::Open("$ENV:TEMP\$_.zip", 'read')), "$ENV:windir\System32\WindowsPowerShell\v1.0\Modules\$_")
            }
        }
        
    }
    Install-Module -Name msp360 -Force -AllowPrerelease:$AllowAlpha
    Import-Module -Name msp360 -Force
}