Advanced: Create a Windows Installer EXE
Creating a Windows Installer using Nullsoft Scriptable Install System (NSIS)
Example NSIS script for Chrome
Name "PixieBrix Installer"
OutFile "PixieBrix-NoClient.exe"
RequestExecutionLevel admin ; Require admin rights
SilentInstall silent
; Define pages only for non-silent installation
!include "MUI2.nsh"
!ifdef MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_DIRECTORY
!endif
!ifdef MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_INSTFILES
!endif
!insertmacro MUI_LANGUAGE "English"
Var /GLOBAL SilentInstall
Function .onInit
; Check if the installer is running in silent mode
StrCmp $CMDLINE "/S" 0 +2
StrCpy $SilentInstall "true"
FunctionEnd
Section "Install Chrome Extension" SecExtension
SetShellVarContext all ; Set to affect all users
; Create the registry key if it doesn't exist
WriteRegStr HKLM "SOFTWARE\Policies\Google\Chrome\ExtensionInstallForcelist" "10" "mpjjildhmpddojocokjkgmlkkkfjnepo;https://clients2.google.com/service/update2/crx"
; Display a finished message only if not silent
StrCmp $SilentInstall "true" +2
; MessageBox MB_OK "Chrome extension has been successfully registered."
SectionEnd
Section "Uninstall"
; This is where uninstallation code would go, if necessary
DeleteRegValue HKLM "SOFTWARE\Policies\Google\Chrome\ExtensionInstallForcelist" "10"
SectionEndLast updated
Was this helpful?