Windows 10 unsupervised kiosk mode without assigned access

With no further ado – The code

As of late I was required to put an app in kiosk mode on Windows 10.

`The app itself is a web application written in react and mongo (that a subject for another post) served using thin client wrapping WebBrowser .Net Component – see my KioskAppNetWindowWrapper source on github.

The Requirements

The application that runs on top of the kiosk is required to be highly available during my client working hours.

Because the final platform is still unknown and we needed flexibility for tomorrow, the app was developed as WebApp with intention to be portable to all OS riding on web browser as UI interface – e.g. Today it’s running on Windows but tomorrow it may run on Android Tablet – so only a thin layer of OS dependant code runs it, again – see my KioskAppNetWindowWrapper source on github.

Also first version is a pilot, I decided to run everything on the local machine (win 10 kiosk/nodejs/mongo/react) So I needed to run the WebApp to from localhost.

Another important requirement is that the app should never be closed/killed by the user and/or relaunch on crashes and without supervision.

One final issue that needed to be cared of is that the web app running or a long period of time inside a WebBrowser might leak for many reason and if it’s never restarted it may cause slowness or undetected crashes in the web browser.  And the same can happen to Windows OS, so I wanted and auto restart once a day at specific non-working hour.

Implementation Considerations

Windows 10 supports a feature called “Assigned Access” which allows defining a single application that runs on top of the lock screen and provides kiosk behaviour for a specific user .

Why I didn’t used Windows 10 Kiosk Mode?

My immediate intuition was to use assigned access app, and I found on the Windows application store some apps that should seamlessly help me (Browser Kiosk / + SP) easily complete the development.

Unfortunately, it wasn’t as such! Hard setup steps, just led me to find that the Browser Kiosk app doesn’t support running the app from localhost for unknown reason. Also the browser kiosk app can be killed by the user and there’s nothing that promise me that the application will continue running at all times without supervision. and for other related reason I had to find another solution.

After investigating a bit further I found that kiosk mode using assigned access just requires the extra work and study which I wasn’t in the mood for and I went back to old school way of doing it.

Old School Set Up

For auto login I used the following registry settings

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon] 
"AutoAdminLogon"="1"
"ForceAutoLogon"="1"
"DefaultUserName"="kiosk"
"DefaultDomainName"="<place here pc hostname>"
"DefaultPassword"=""

For nodejs auto startup from boot and while reboot

I used PM2 with

  • npm install pm2@latest -g
  • cd to working directory
  • pm2 start server.js
  • npm install pm2-windows-startup -g
  • pm2-startup install
  • pm2 save # for dumping the server startup for reboots

For app wrapper auto startup, just:

  1. install the kiosk wrapper from github (use web.config file to setup your own link and properties)
  2. crate a shortcut to the kiosk wrapper app
  3. WIN+R and copy+paste ‘shell:startup’ command to open the startup folder
  4. create a batch file with delay of few second to let the PM2 the chance the load the nodejs app first and then start the wrapper
  5. drag the shortcut of the batch into the startup folder

Disable Lock Screen, I used the following registry settings:

[HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Personalization] "NoLockScreen"="1" {DWORD (32-bit)}

references:

  1. Kiosk Mode setting for non assigned access mode – https://stackoverflow.com/questions/41938422/how-to-run-a-c-sharp-program-in-kiosk-mode/41979285#41979285
  2. (How to) Kiosk Mode in assigned access – https://docs.microsoft.com/en-us/windows/configuration/kiosk-single-app
  3. https://www.howtogeek.com/228467/how-to-make-a-program-run-at-startup-on-any-computer/
  4. Disable lock screen – https://www.cnet.com/how-to/how-to-disable-the-windows-10-lock-screen/