syedhassaanahmed / kiosk-demo-electron

Package and distribute Electron Apps and run them in Kiosk mode on Windows 10
MIT License
80 stars 17 forks source link
appveyor docker electron electron-packager msi powershell windows-10 winehq winetricks wix-toolset

kiosk-demo-electron

Build status

This repository demonstrates how to package and distribute an Electron App which runs in Kiosk mode on Windows 10. It uses the Windows 10 Shell Launcher as well as set the kiosk user to AutoLogon. Packaging the app as an MSI makes sure we can distribute it to multiple kiosks via an MDM solution e.g Microsoft Intune.

Note: Shell Launcher feature requires Windows 10 Enterprise Edition.

The project is described in-depth in this blog post

Create Installer

Windows

npm run dist will build everything and create the MSI in dist folder.

Linux

Use npm run dist:wine. Script assumes that Wine and dotnet45 (using winetricks) are installed and properly configured. If the full path of any of your electron-packager output files is longer than 128 chars, you'll run into error LGHT0103 : The system cannot find the file. Note: Light.exe has a known issue with MSI validation on Wine so it had to be turned off with -sval flag.

Docker

npm run dist:docker will spin up an instance of this image, execute the above wine script and then copy artifacts back to host's dist folder. Script assumes that Docker daemon is running on host.

Configure

Kiosk parameters are passed to the installer like this:

KioskDemoElectron.msi KIOSK_USERNAME=<kiosk user> KIOSK_PASSWORD=<kiosk password>

All params have a default value as can be seen in product.wxs.

How it works

Why WiX instead of electron-winstaller (Squirrel.Windows)?

In our case, WiX provides lot of flexibility in terms of configuring the installer;

Troubleshoot

MSI logging can be enabled by executing the installer like this:

msiexec /i "setup.msi" /l*v "msi.log" PARAM=VALUE

PowerShell log will be written in C:\Windows\SysWOW64\powershell.log.

Telemetry

The solution uses Application Insights to collect basic telemetry data from the app. To enable it, please create an environment variable named APPINSIGHTS_INSTRUMENTATIONKEY and set it to the Instrumentation Key obtained from Azure portal.