mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-17 15:28:16 +00:00
install powershell modules
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
function Get-ToolsetContent
|
||||
{
|
||||
$toolset = Join-Path $env:INSTALLER_SCRIPT_FOLDER "toolset.json"
|
||||
Get-Content $toolset -Raw | ConvertFrom-Json
|
||||
}
|
||||
|
||||
# Specifies the installation policy
|
||||
Set-PSRepository -InstallationPolicy Trusted -Name PSGallery
|
||||
|
||||
# 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
|
||||
}
|
||||
Reference in New Issue
Block a user