File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 88$PSStyle.OutputRendering = ' Ansi'
99
1010' platyPS' | ForEach-Object {
11- Install-PSResource - Name $_ - WarningAction SilentlyContinue - TrustRepository - Repository PSGallery
12- Import-Module - Name $_
11+ $name = $_
12+ Write-Output " Installing module: $name "
13+ $retryCount = 5
14+ $retryDelay = 10
15+ for ($i = 0 ; $i -lt $retryCount ; $i ++ ) {
16+ try {
17+ Install-PSResource - Name $name - WarningAction SilentlyContinue - TrustRepository - Repository PSGallery
18+ break
19+ } catch {
20+ Write-Warning " Installation of $ ( $psResourceParams.Name ) failed with error: $_ "
21+ if ($i -eq $retryCount - 1 ) {
22+ throw
23+ }
24+ Write-Warning " Retrying in $retryDelay seconds..."
25+ Start-Sleep - Seconds $retryDelay
26+ }
27+ }
28+ Import-Module - Name $name
1329}
1430
1531$path = (Join-Path - Path $PSScriptRoot - ChildPath ' helpers' ) | Get-Item | Resolve-Path - Relative
You can’t perform that action at this time.
0 commit comments