@@ -60,14 +60,14 @@ function Install-AzModuleInternal {
6060 [string ]$tempRepo = Join-Path ([Path ]::GetTempPath()) ((New-Guid ).Guid)
6161 # $tempRepo = Join-Path 'D:/PSLocalRepo/' (Get-Date -Format "yyyyddMM-HHmm")
6262 if (Test-Path - Path $tempRepo ) {
63- Microsoft.PowerShell.Management\Remove-Item - Path $tempRepo - Recurse - WhatIf:$false - ErrorVariable errorRecords
63+ Microsoft.PowerShell.Management\Remove-Item - Path $tempRepo - Recurse - WhatIf:$false
6464 }
65- $null = Microsoft.PowerShell.Management\New-Item - ItemType Directory - Path $tempRepo - WhatIf:$false - ErrorVariable errorRecords
65+ $null = Microsoft.PowerShell.Management\New-Item - ItemType Directory - Path $tempRepo - WhatIf:$false
6666 Write-Debug " [$Invoker ] The repository folder $tempRepo is created."
6767
68- PowerShellGet\Unregister-PSRepository - Name $script :AzTempRepoName - ErrorAction ' SilentlyContinue'
69- PowerShellGet\Register-PSRepository - Name $script :AzTempRepoName - SourceLocation $tempRepo - ErrorAction ' Stop' - ErrorVariable errorRecords
70- PowerShellGet\Set-PSRepository - Name $script :AzTempRepoName - InstallationPolicy Trusted - ErrorVariable errorRecords
68+ $null = PowerShellGet\Unregister-PSRepository - Name $script :AzTempRepoName - ErrorAction ' SilentlyContinue'
69+ $null = PowerShellGet\Register-PSRepository - Name $script :AzTempRepoName - SourceLocation $tempRepo - ErrorAction ' Stop' - ErrorVariable + errorRecords
70+ PowerShellGet\Set-PSRepository - Name $script :AzTempRepoName - InstallationPolicy Trusted
7171 Write-Debug " [$Invoker ] The temporary repository $script :AzTempRepoName is registered."
7272
7373 $InstallStarted = Get-Date
@@ -126,7 +126,7 @@ function Install-AzModuleInternal {
126126 if ($confirmUninstallation ) {
127127 PowerShellGet\Uninstall-Module - Name " Az.Accounts" - AllVersion - AllowPrerelease - ErrorAction ' SilentlyContinue'
128128 }
129- PowerShellGet\Install-Module @installModuleParams - Name " Az.Accounts" - RequiredVersion " $ ( $modules [0 ].Version) " - ErrorVariable + errorRecords
129+ PowerShellGet\Install-Module @installModuleParams - Name " Az.Accounts" - RequiredVersion " $ ( $modules [0 ].Version) "
130130 }
131131 $moduleInstalled += [PSCustomObject ]@ {
132132 Name = " Az.Accounts"
@@ -173,7 +173,7 @@ function Install-AzModuleInternal {
173173 if ($RemovePrevious ) {
174174 PowerShellGet\Uninstall-Module - Name $moduleName - AllVersion - AllowPrerelease - ErrorAction ' SilentlyContinue'
175175 }
176- PowerShellGet\Install-Module @installModuleParam - Name $moduleName - RequiredVersion " $moduleVersion " - ErrorVariable + errorRecords
176+ PowerShellGet\Install-Module @installModuleParam - Name $moduleName - RequiredVersion " $moduleVersion "
177177 $state = " succeeded"
178178 }
179179 catch {
@@ -205,9 +205,9 @@ function Install-AzModuleInternal {
205205 $jobs += Start-ThreadJob - Name " Az.Tools.Installer" - InitializationScript $functions - ScriptBlock {
206206 $tmodule = $using :module
207207 $tInstallModuleParam = $using :installModuleParams
208- $result = Install-SingleModule - ModuleName $tmodule.Name - ModuleVersion $tmodule.Version - InstallModuleParam $tInstallModuleParam - RemovePrevious:($using :confirmUninstallation ) - ErrorVariable + errorRecords
208+ $result = Install-SingleModule - ModuleName $tmodule.Name - ModuleVersion $tmodule.Version - InstallModuleParam $tInstallModuleParam - RemovePrevious:($using :confirmUninstallation )
209209 Write-Output $result
210- } - ThrottleLimit $maxJobCount - ErrorVariable + errorRecords
210+ } - ThrottleLimit $maxJobCount
211211 }
212212 }
213213 else {
@@ -230,7 +230,7 @@ function Install-AzModuleInternal {
230230 $jobs += Start-Job - Name " Az.Tools.Installer" - InitializationScript $functions - ScriptBlock {
231231 $tmodule = $using :module
232232 $tInstallModuleParam = $using :installModuleParams
233- $result = Install-SingleModule - ModuleName $tmodule.Name - ModuleVersion $tmodule.Version - InstallModuleParam $tInstallModuleParam - RemovePrevious:($using :confirmUninstallation ) - ErrorVariable + errorRecords
233+ $result = Install-SingleModule - ModuleName $tmodule.Name - ModuleVersion $tmodule.Version - InstallModuleParam $tInstallModuleParam - RemovePrevious:($using :confirmUninstallation )
234234 Write-Output $result
235235 }
236236 Write-Progress - ParentId $script :FixProgressBarId - Activity " Install Module" - Status " $ ( $module.Name ) version $ ( $module.Version ) " - PercentComplete ($index / $modules.Count * 100 )
@@ -255,9 +255,9 @@ function Install-AzModuleInternal {
255255 }
256256 }
257257 else {
258- Write-Error " [$Invoker ] Installing $ ( $result.ModuleName ) of version $ ( $result.ModuleVersion ) is failed. `n $ ( $result.Error ) " - ErrorVariable + errorRecords
258+ Write-Error " [$Invoker ] Installing $ ( $result.ModuleName ) of version $ ( $result.ModuleVersion ) is failed. `n $ ( $result.Error ) "
259259 }
260- Remove-Job $job - Confirm:$false - ErrorVariable + errorRecords
260+ Remove-Job $job - Confirm:$false
261261 if ($PSVersionTable.PSEdition -eq " Core" ) {
262262 Write-Progress - ParentId $script :FixProgressBarId - Activity " Install Module" - Status " $ ( $result.ModuleName ) of version $ ( $result.ModuleVersion ) " - PercentComplete ($index / $jobs.Count * 100 )
263263 $index += 1
@@ -271,7 +271,7 @@ function Install-AzModuleInternal {
271271 $jobs = Get-Job - Name " Az.Tools.Installer" - ErrorAction ' SilentlyContinue'
272272 if ($jobs ) {
273273 Stop-Job $jobs
274- Remove-Job $jobs - Confirm:$false - ErrorVariable + errorRecords
274+ Remove-Job $jobs - Confirm:$false
275275 }
276276 }
277277
@@ -282,11 +282,11 @@ function Install-AzModuleInternal {
282282 if ($Force -or ! $WhatIfPreference ) {
283283 if (! $DontClean ) {
284284 Write-Debug " [$Invoker ] The temporary repository $script :AzTempRepoName is unregistered."
285- PowerShellGet\Unregister-PSRepository - Name $script :AzTempRepoName - ErrorAction ' Continue' - ErrorVariable + errorRecords
285+ $null = PowerShellGet\Unregister-PSRepository - Name $script :AzTempRepoName - ErrorAction ' Continue'
286286
287287 Write-Debug " [$Invoker ] The Repository folder $tempRepo is removed."
288288 if (Test-Path - Path $tempRepo ) {
289- Microsoft.PowerShell.Management\Remove-Item - Path $tempRepo - Recurse - WhatIf:$false - ErrorVariable + errorRecords
289+ Microsoft.PowerShell.Management\Remove-Item - Path $tempRepo - Recurse - WhatIf:$false
290290 }
291291 }
292292 }
0 commit comments