mirror of
https://github.com/actions/runner-images.git
synced 2025-12-29 21:42:55 +08: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
@@ -5,8 +5,6 @@
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
Set-PSRepository -InstallationPolicy Trusted -Name PSGallery
|
||||
|
||||
# The correct Modules need to be saved in C:\Modules
|
||||
$installPSModulePath = $env:PSMODULES_ROOT_FOLDER
|
||||
if (-not (Test-Path -LiteralPath $installPSModulePath))
|
||||
|
||||
@@ -5,10 +5,6 @@
|
||||
## can continue.
|
||||
################################################################################
|
||||
|
||||
Set-PSRepository -InstallationPolicy Trusted -Name PSGallery
|
||||
Write-Host "Install-Module DockerProvider"
|
||||
Install-Module DockerMsftProvider -Force
|
||||
|
||||
Write-Host "Install-Package Docker"
|
||||
Install-Package -Name docker -ProviderName DockerMsftProvider -Force
|
||||
Start-Service docker
|
||||
|
||||
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"
|
||||
@@ -19,7 +19,3 @@ Install-Binary -Url $SharedManagementObjectsUrl -Name $SharedManagementObjectsNa
|
||||
$PowerShellToolsName = "PowerShellTools.msi"
|
||||
$PowerShellToolsUrl = "${BaseUrl}/${PowerShellToolsName}"
|
||||
Install-Binary -Url $PowerShellToolsUrl -Name $PowerShellToolsName
|
||||
|
||||
# install sqlserver PS module
|
||||
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
|
||||
Install-Module -Name SqlServer -AllowClobber
|
||||
@@ -5,5 +5,4 @@
|
||||
################################################################################
|
||||
|
||||
Write-Host "Run windows updates"
|
||||
Install-Module -Name PSWindowsUpdate -Force -AllowClobber
|
||||
Get-WUInstall -MicrosoftUpdate -AcceptAll -Install -IgnoreUserInput -IgnoreReboot
|
||||
|
||||
@@ -33,17 +33,6 @@ function Disable-UserAccessControl {
|
||||
# Set TLS1.2
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12"
|
||||
|
||||
Import-Module -Name ImageHelpers -Force
|
||||
|
||||
Write-Host "Setup PowerShellGet"
|
||||
# Set-PSRepository -InstallationPolicy Trusted -Name PSGallery
|
||||
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
|
||||
Install-Module -Name PowerShellGet -Force
|
||||
Set-PSRepository -InstallationPolicy Trusted -Name PSGallery
|
||||
|
||||
Write-Host "Install the latest Pester version"
|
||||
Install-Module Pester -Scope AllUsers -SkipPublisherCheck -Force
|
||||
|
||||
Write-Host "Disable Antivirus"
|
||||
Set-MpPreference -DisableRealtimeMonitoring $true
|
||||
|
||||
|
||||
@@ -30,17 +30,6 @@ function Disable-UserAccessControl {
|
||||
Write-Host "User Access Control (UAC) has been disabled."
|
||||
}
|
||||
|
||||
Import-Module -Name ImageHelpers -Force
|
||||
|
||||
Write-Host "Setup PowerShellGet"
|
||||
# Set-PSRepository -InstallationPolicy Trusted -Name PSGallery
|
||||
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
|
||||
Install-Module -Name PowerShellGet -Force
|
||||
Set-PSRepository -InstallationPolicy Trusted -Name PSGallery
|
||||
|
||||
Write-Host "Install the latest Pester version"
|
||||
Install-Module Pester -Scope AllUsers -SkipPublisherCheck -Force
|
||||
|
||||
Write-Host "Disable Antivirus"
|
||||
Set-MpPreference -DisableRealtimeMonitoring $true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user