Category filter
Script to set up website kiosk on Windows devices
Website kiosk is a restrictive browsing environment that limits access to a single website within a specified browser. Setting up a website kiosk restricts the user from accessing any websites other than the dedicated one specified for the kiosk, which is ideal for creating guided learning experiences in schools or providing access to online resources in public libraries. With the help of a script, IT admins can set up a website kiosk for a particular user account, wherein the kiosk activates each time the account is accessed. IT admins can execute the script by using Hexnode’s Execute Custom Script remote action.
PowerShell script to enable website kiosk mode
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
try{ Write-Host "Scheduling website kiosk for user" $username = "User" # Unregister any existing task with the same name from task scheduler try { $a=Unregister-ScheduledTask -TaskName 'TaskName' -Confirm:$false -ErrorAction:Ignore } catch { Write-Host "Error while unregistering schedule task-->",$_.Exception.Message } #scheduling task $action1 = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument 'taskkill /f /im explorer.exe' $action2 = New-ScheduledTaskAction -Execute 'C:\Program Files\Google\Chrome\Application\chrome.exe' -Argument '-kiosk https://hexnode.com' $actions = @($action1, $action2) $principal = New-ScheduledTaskPrincipal -UserId $username -RunLevel Highest $trigger = New-ScheduledTaskTrigger -AtLogon -User $username $settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries $task = New-ScheduledTask -Action $actions -Principal $principal -Settings $settings -Trigger $trigger $reg= Register-ScheduledTask 'TaskName' -InputObject $task } catch { Write-Host "Exception inside running script-->",$_.Exception.Message } |
To enable kiosk mode on the desired user account, replace ‘User’ with the actual username of the device.
Replace the “TaskName” with a unique name of your preference throughout the script. Before scheduling the new task, any pre-existing task with the same name should be unregistered from the task scheduler.
After that the script terminates Windows Explorer and runs the Google Chrome app in kiosk mode, displaying the specified website in full-screen mode. Replace the URL ‘https://hexnode.com’ in the script with the desired web address for the website to be displayed in kiosk mode.
The script uses the try and catch blocks to handle any exceptions that occur during execution.
What happens at the device end?
If the account is already logged in when the script is executed, the device is required to be restarted. After executing the script, the website kiosk scheduled for the specified user account will be activated whenever the account is accessed.