Enrol Chrome from the installers, and drop load-unpacked

Both setup scripts ended by telling you to load the folder unpacked, which is
the one install that cannot update itself - and the policy install they moved
to next does nothing on an unmanaged machine. Enrolment is the step that
actually matters: with it, the extension arrives from the Admin console already
force-installed, and there is nothing else to configure on the box.

So step 7 now asks for an enrolment token instead. The Windows script elevates
itself for it - the token is machine-scoped, and that is the only UAC prompt in
the whole install.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Brandon Li
2026-08-31 16:14:14 -05:00
co-authored by Claude Opus 5
parent 95c073d4c2
commit 35dd15d584
4 changed files with 82 additions and 56 deletions
+25 -23
View File
@@ -325,23 +325,27 @@ set "AUTOSTART=0"
:autostart_done
REM ------------------------------------------------------- extension policy
REM Chrome refuses to side-load a CRX and will not update an unpacked folder, so
REM the extension is installed the way a self-hosted one has to be: a policy
REM entry naming our update server. Written to this user's hive, which needs no
REM elevation - install-extension-policy.ps1 -Scope Machine covers every account.
REM ------------------------------------------------------------ extension
REM Chrome refuses to side-load a CRX and will not update an unpacked folder, and
REM it only force-installs an off-store extension on a managed browser. Enrolling
REM in Chrome Enterprise Core is what makes this machine's Chrome managed; the
REM extension itself then arrives from the Admin console, already set to force
REM install, with nothing further to configure here.
echo.
echo [7/7] Browser extension
echo Installs it from the update server into whichever of Chrome, Edge
echo and Brave are present, and lets them keep it current by themselves.
echo No administrator rights needed.
set "DOEXT="
set /p "DOEXT= Set this up now? [Y/n] "
if /i "%DOEXT%"=="n" goto :ext_skipped
powershell -NoProfile -ExecutionPolicy Bypass -File "%TARGET%\scripts\install-extension-policy.ps1"
echo [7/7] Chrome extension
echo Enrols this machine's Chrome, after which the extension installs
echo itself from the Admin console and stays updated on its own.
echo The token is in the Admin console under
echo Devices ^> Chrome ^> Managed browsers. Blank to skip.
set "ENROLTOKEN="
set /p "ENROLTOKEN= Enrollment token: "
if not defined ENROLTOKEN goto :ext_skipped
REM The token is machine-scoped, so this raises a UAC prompt and only this. The
REM script asks for elevation itself; nothing else in this installer needs it.
powershell -NoProfile -ExecutionPolicy Bypass -File "%TARGET%\scripts\enroll-chrome-management.ps1" -Token "%ENROLTOKEN%"
if errorlevel 1 (
echo [!] Extension policy failed. Load %TARGET%\extension unpacked for now,
echo and re-run scripts\install-extension-policy.ps1 to try again.
echo [!] Enrolment failed. Re-run scripts\enroll-chrome-management.ps1 with
echo a fresh token from the Admin console to try again.
set "EXTPOLICY=0"
) else (
set "EXTPOLICY=1"
@@ -349,8 +353,8 @@ if errorlevel 1 (
goto :ext_done
:ext_skipped
echo Skipped. Run scripts\install-extension-policy.ps1 later, or load
echo %TARGET%\extension unpacked and reload it by hand after updates.
echo Skipped. Run scripts\enroll-chrome-management.ps1 -Token ^<token^>
echo later; until then this machine gets no extension.
set "EXTPOLICY=0"
:ext_done
@@ -392,13 +396,11 @@ echo Handy : pm2 list ^| pm2 logs autofirmer ^| pm2 logs clicker
echo.
echo Still manual:
if "%EXTPOLICY%"=="1" (
echo - Restart Chrome, and remove any unpacked copy of the extension
echo ^(it shares the same id now, and Chrome will not load both^)
echo - Restart Chrome. chrome://management should name your organisation,
echo and the extension installs itself within a minute or two.
) else (
echo - Load the Chrome extension: chrome://extensions, enable Developer
echo mode, "Load unpacked", select %TARGET%\extension
echo ^(loaded that way it reloads itself from disk after a pull;
echo the policy install lets Chrome update it properly^)
echo - Enrol Chrome so it can install the extension:
echo scripts\enroll-chrome-management.ps1 -Token ^<token^>
)
echo - Add your firm credentials on the dashboard's Settings page
echo.