Files
runner-images/images/linux/scripts/installers/Install-PowerShellModules.ps1
T

35 lines
1.0 KiB
PowerShell
Raw Normal View History

2020-09-14 16:25:33 +03:00
$ErrorActionPreference = "Stop"
$ProgressPreference = "SilentlyContinue"
2020-09-14 16:25:33 +03:00
Import-Module "$env:HELPER_SCRIPTS/Tests.Helpers.psm1" -DisableNameChecking
2020-09-14 16:25:33 +03:00
# Specifies the installation policy
Set-PSRepository -InstallationPolicy Trusted -Name PSGallery
# Try to update PowerShellGet before the actual installation
Install-Module -Name PowerShellGet -Force
Update-Module -Name PowerShellGet -Force
2020-09-14 16:25:33 +03:00
# Install PowerShell modules
$modules = (Get-ToolsetContent).powershellModules
foreach($module in $modules)
{
$moduleName = $module.name
Write-Host "Installing ${moduleName} module"
if ($module.versions)
{
foreach ($version in $module.versions)
{
Write-Host " - $version"
Install-Module -Name $moduleName -RequiredVersion $version -Scope AllUsers -SkipPublisherCheck -Force
}
continue
}
Install-Module -Name $moduleName -Scope AllUsers -SkipPublisherCheck -Force
}
Invoke-PesterTests -TestFile "PowerShellModules" -TestName "PowerShellModules"