From 24711b37255c0e24f4c96f22d31b21a0c439e8e7 Mon Sep 17 00:00:00 2001 From: Ryan Richter Date: Wed, 24 Jul 2024 12:19:58 -0400 Subject: [PATCH] (maint) Fix Edge Package Test Add handling to bring edge under Chocolatey management if it was natively installed by a newer server OS --- Start-C4bNexusSetup.ps1 | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Start-C4bNexusSetup.ps1 b/Start-C4bNexusSetup.ps1 index e8bc63c..6245571 100644 --- a/Start-C4bNexusSetup.ps1 +++ b/Start-C4bNexusSetup.ps1 @@ -96,9 +96,25 @@ 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" + 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 + } + } + } + else { Write-Host "Installing Microsoft Edge, to allow viewing the Nexus site" - choco install microsoft-edge -y --source ChocolateyInternal + choco install microsoft-edge -y --source ChocolateyCore if ($LASTEXITCODE -eq 0) { if (Test-Path 'HKLM:\SOFTWARE\Microsoft\Edge') { $RegArgs = @{