mirror of
https://github.com/actions/runner-images.git
synced 2025-12-15 06:08:07 +00:00
[Windows] Add the list of installed PowerShell modules to documentation (#1266)
* documenation about powershell modules * add powershell modules documenation * add PSMODULES_ROOT_FOLDER
This commit is contained in:
committed by
GitHub
parent
544204ec06
commit
00463a8fab
34
images/win/scripts/Installers/Install-PowerShellModules.ps1
Normal file
34
images/win/scripts/Installers/Install-PowerShellModules.ps1
Normal file
@@ -0,0 +1,34 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
# Set TLS1.2
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12"
|
||||
|
||||
Write-Host "Setup PowerShellGet"
|
||||
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
|
||||
|
||||
# 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
|
||||
}
|
||||
|
||||
Import-Module Pester
|
||||
Invoke-PesterTests -TestFile "PowerShellModules" -TestName "PowerShellModules"
|
||||
Reference in New Issue
Block a user