$ErrorActionPreference='Stop' for AllUsersAllHosts

This commit is contained in:
Aleksandr Chebotov
2020-10-02 10:59:05 +03:00
parent 42d210e4e7
commit 0cd68997b6
14 changed files with 5 additions and 26 deletions

View File

@@ -27,8 +27,6 @@ Function Set-DefaultVariables
} }
} }
$ErrorActionPreference = "Stop"
Import-Module -Name ImageHelpers -Force -DisableNameChecking Import-Module -Name ImageHelpers -Force -DisableNameChecking
# Define executables for cached tools # Define executables for cached tools

View File

@@ -6,8 +6,6 @@
Write-Host "Cleanup WinSxS" Write-Host "Cleanup WinSxS"
Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase
$ErrorActionPreference = 'silentlycontinue'
Write-Host "Clean up various directories" Write-Host "Clean up various directories"
@( @(
"C:\\Recovery", "C:\\Recovery",
@@ -30,4 +28,5 @@ Write-Host "Clean up various directories"
$winInstallDir = "$env:windir\\Installer" $winInstallDir = "$env:windir\\Installer"
New-Item -Path $winInstallDir -ItemType Directory -Force New-Item -Path $winInstallDir -ItemType Directory -Force
$ErrorActionPreference = 'Continue' # Remove AllUsersAllHosts profile
Remove-Item $profile.AllUsersAllHosts -Force

View File

@@ -30,6 +30,9 @@ function Disable-UserAccessControl {
Write-Host "User Access Control (UAC) has been disabled." Write-Host "User Access Control (UAC) has been disabled."
} }
# Enable $ErrorActionPreference='Stop' for AllUsersAllHosts
Add-Content -Path $profile.AllUsersAllHosts -Value '$ErrorActionPreference="Stop"'
# Set TLS1.2 # Set TLS1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12" [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12"

View File

@@ -3,8 +3,6 @@
## Desc: Install Azure PowerShell modules ## Desc: Install Azure PowerShell modules
################################################################################ ################################################################################
$ErrorActionPreference = "Stop"
# The correct Modules need to be saved in C:\Modules # The correct Modules need to be saved in C:\Modules
$installPSModulePath = $env:PSMODULES_ROOT_FOLDER $installPSModulePath = $env:PSMODULES_ROOT_FOLDER
if (-not (Test-Path -LiteralPath $installPSModulePath)) if (-not (Test-Path -LiteralPath $installPSModulePath))

View File

@@ -2,8 +2,6 @@
## File: Install-PHP.ps1 ## File: Install-PHP.ps1
## Desc: Install PHP ## Desc: Install PHP
################################################################################ ################################################################################
$ErrorActionPreference = "Stop"
Import-Module -Name ImageHelpers Import-Module -Name ImageHelpers
# Install latest PHP in chocolatey # Install latest PHP in chocolatey

View File

@@ -1,5 +1,3 @@
$ErrorActionPreference = "Stop"
#Define user and password for PostgreSQL database #Define user and password for PostgreSQL database
$pgUser = "postgres" $pgUser = "postgres"
$pgPwd = "root" $pgPwd = "root"

View File

@@ -1,5 +1,3 @@
$ErrorActionPreference = "Stop"
# Set TLS1.2 # Set TLS1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12" [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12"

View File

@@ -82,7 +82,6 @@ function Install-PyPy
} }
} }
$ErrorActionPreference = "Stop"
Import-Module -Name ImageHelpers -Force -DisableNameChecking Import-Module -Name ImageHelpers -Force -DisableNameChecking
# Get PyPy content from toolset # Get PyPy content from toolset

View File

@@ -2,8 +2,6 @@
## File: Install-Sbt.ps1 ## File: Install-Sbt.ps1
## Desc: Install sbt for Windows ## Desc: Install sbt for Windows
################################################################################ ################################################################################
$ErrorActionPreference = "Stop"
Import-Module -Name ImageHelpers Import-Module -Name ImageHelpers
# Install the latest version of sbt. # Install the latest version of sbt.

View File

@@ -29,8 +29,6 @@ Function Install-Asset {
Pop-Location Pop-Location
} }
$ErrorActionPreference = "Stop"
Import-Module -Name ImageHelpers -Force Import-Module -Name ImageHelpers -Force
# Get toolcache content from toolset # Get toolcache content from toolset

View File

@@ -3,8 +3,6 @@
## Desc: Install Visual Studio ## Desc: Install Visual Studio
################################################################################ ################################################################################
$ErrorActionPreference = "Stop"
$toolset = Get-ToolsetContent $toolset = Get-ToolsetContent
$requiredComponents = $toolset.visualStudio.workloads | ForEach-Object { "--add $_" } $requiredComponents = $toolset.visualStudio.workloads | ForEach-Object { "--add $_" }
$workLoads = @( $workLoads = @(

View File

@@ -3,8 +3,6 @@
## Desc: Install the Visual Studio Extensions from toolset.json ## Desc: Install the Visual Studio Extensions from toolset.json
################################################################################### ###################################################################################
$ErrorActionPreference = "Stop"
$toolset = Get-ToolsetContent $toolset = Get-ToolsetContent
$vsixPackagesList = $toolset.visualStudio.vsix $vsixPackagesList = $toolset.visualStudio.vsix
if (-not $vsixPackagesList) { if (-not $vsixPackagesList) {

View File

@@ -3,8 +3,6 @@
## Desc: Install and update Android SDK and tools ## Desc: Install and update Android SDK and tools
################################################################################ ################################################################################
$ErrorActionPreference = "Stop"
# Install the standard Android SDK licenses. In the past, there wasn't a better way to do this, # Install the standard Android SDK licenses. In the past, there wasn't a better way to do this,
# so we are base64-encoding a zip of the licenses directory from another installation. # so we are base64-encoding a zip of the licenses directory from another installation.
# To create this base64 string, create a zip file that contains nothing but a 'licenses' folder, # To create this base64 string, create a zip file that contains nothing but a 'licenses' folder,

View File

@@ -1,5 +1,3 @@
$ErrorActionPreference = "Stop"
Import-Module MarkdownPS Import-Module MarkdownPS
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Android.psm1") -DisableNameChecking Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Android.psm1") -DisableNameChecking
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Browsers.psm1") -DisableNameChecking Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Browsers.psm1") -DisableNameChecking