From c7fe463f466eba8527fbab1bf3b1809fbdf06ac7 Mon Sep 17 00:00:00 2001 From: Ryan Richter Date: Wed, 24 Jul 2024 12:19:58 -0400 Subject: [PATCH] (fix) Fix Flaky Edge Package Test Add handling to bring edge under Chocolatey management if it was natively installed by a newer server OS. This should ensure that the test is more consistent, delivering the same result regardless of if the Chocolatey package were installed or not. --- Start-C4bNexusSetup.ps1 | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/Start-C4bNexusSetup.ps1 b/Start-C4bNexusSetup.ps1 index dbc7b52..c3c8658 100644 --- a/Start-C4bNexusSetup.ps1 +++ b/Start-C4bNexusSetup.ps1 @@ -98,20 +98,24 @@ process { choco source add -n 'ChocolateyCore' -s "$((Get-NexusRepository -Name 'ChocolateyCore').url)/index.json" --priority 0 --admin-only # Install a non-IE browser for browsing the Nexus web portal. - if (-not (Test-Path 'C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe')) { + if (Test-Path 'C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe'){ + Write-Host "Syncing Microsoft Edge, to bring it under Chocolatey management" + choco sync --id="Microsoft Edge" --package-id="microsoft-edge" + } + else { Write-Host "Installing Microsoft Edge, to allow viewing the Nexus site" - choco install microsoft-edge -y --source ChocolateyInternal - if ($LASTEXITCODE -eq 0) { - if (Test-Path 'HKLM:\SOFTWARE\Microsoft\Edge') { - $RegArgs = @{ - Path = 'HKLM:\SOFTWARE\Microsoft\Edge\' - Name = 'HideFirstRunExperience' - Type = 'Dword' - Value = 1 - Force = $true - } - $null = Set-ItemProperty @RegArgs + choco install microsoft-edge -y --source ChocolateyCore + } + if ($LASTEXITCODE -eq 0) { + if (Test-Path 'HKLM:\SOFTWARE\Microsoft\Edge') { + $RegArgs = @{ + Path = 'HKLM:\SOFTWARE\Microsoft\Edge\' + Name = 'HideFirstRunExperience' + Type = 'Dword' + Value = 1 + Force = $true } + $null = Set-ItemProperty @RegArgs } }