private/Install-MSP360Module.ps1
function Install-MSP360Module { if ($Host.Version.Major -ge 5){ Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force Install-Module -Name msp360 -Force Import-Module -Name msp360 -Force }else{ $ModuleInfo = ( Invoke-Expression ((New-Object IO.StreamReader(([IO.Compression.ZipFile]::OpenRead("$ENV:TEMP\msp360.zip").Entries | Where-Object {$_.Name -eq "msp360.psd1"}).Open())).ReadToEnd() | Out-String )) @('public\api','public\cbb','public\tools','private') | ForEach-Object {$Folder = New-Item -Path "$ENV:windir\System32\WindowsPowerShell\v1.0\Modules\msp360\$($ModuleInfo.ModuleVersion)" -Name $_ -ItemType "directory" -ErrorAction SilentlyContinue} [IO.Compression.ZipFile]::OpenRead("$ENV:TEMP\msp360.zip").Entries | Where-Object {$_.Name -like "*.ps*1"}| ForEach-Object {[IO.Compression.ZipFileExtensions]::ExtractToFile($_,"$ENV:windir\System32\WindowsPowerShell\v1.0\Modules\msp360\$($ModuleInfo.ModuleVersion)\$_",$true)} } } |