Kiosk Mode Setup
Kiosk Mode Setup
//-----Step_1-----
$COMPUTER = "localhost"
$NAMESPACE = "root\standardcimv2\embedded"
# Create a handle to the class instance so we can call the static methods.
try {
$ShellLauncherClass = [wmiclass]"\\$COMPUTER\${NAMESPACE}:WESL_UserSetting"
} catch [Exception] {
write-host $_.Exception.Message;
write-host "Make sure Shell Launcher feature is enabled"
function Get-UsernameSID($AccountName) {
return $NTUserSID.Value
}
$ShellLauncherClass.SetEnabled($TRUE)
$IsShellLauncherEnabled = $ShellLauncherClass.IsEnabled()
"`nEnabled is set to " + $IsShellLauncherEnabled.Enabled
//-----Step_1end-----
//There shuldnt be any error and Shell launcher shuld be enabled
//-----Step_2-----
//Bellow are user accounts stored as variables, you can use any number of accounts
you want, make shure you have write correct account names
$KIOSK_SID = Get-UsernameSID("KioskMode")
$ADMIN_SID = Get-UsernameSID("AdminPC")
$restart_shell = 0
$restart_device = 1
$shutdown_device = 2
//Setup for other accounts custom shells, for kiosk mode set link to application
$ShellLauncherClass.SetCustomShell($KIOSK_SID,"C:\Users\KioskMode\Desktop\KioskAppF
older\KioskApp.exe", ($null), ($null), $restart_shell)
$ShellLauncherClass.SetCustomShell($ADMIN_SID,"C:\Windows\explorer.exe", ($null),
($null), $restart_shell)
"`nCurrent settings for custom shells:"
Get-WmiObject -namespace $NAMESPACE -computer $COMPUTER -class WESL_UserSetting |
Select Sid, Shell, DefaultAction
//-----Step_2end-----
// If you screw up something in process you cant override shell, you must remove it
first and set up again. This code removes shell:
$ShellLauncherClass.RemoveCustomShell($KIOSK_SID)
Additional links:
https://docs.microsoft.com/en-us/windows-hardware/customize/enterprise/shell-
launcher
https://docs.microsoft.com/en-us/windows/configuration/kiosk-shelllauncher