You are on page 1of 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) {

$NTUserObject = New-Object System.Security.Principal.NTAccount($AccountName)


$NTUserSID =
$NTUserObject.Translate([System.Security.Principal.SecurityIdentifier])

return $NTUserSID.Value

}
$ShellLauncherClass.SetEnabled($TRUE)

$IsShellLauncherEnabled = $ShellLauncherClass.IsEnabled()

"`nEnabled is set to " + $IsShellLauncherEnabled.Enabled


$KIOSK_SID = Get-UsernameSID("KioskMode")
$ADMIN_SID = Get-UsernameSID("Matan")

$restart_shell = 0
$restart_device = 1
$shutdown_device = 2

$ShellLauncherClass.SetDefaultShell("C:\Windows\explorer.exe", $restart_shell)

$DefaultShellObject = $ShellLauncherClass.GetDefaultShell()

"`nDefault Shell is set to " + $DefaultShellObject.Shell + " and the default action
is set to " + $DefaultShellObject.defaultaction

$ShellLauncherClass.SetCustomShell($KIOSK_SID,"C:\Program Files
(x86)\MuralClient\MuralKioskAplikacija.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

$ADMIN_SID = Get-UsernameSID("Matan")
$ShellLauncherClass.SetCustomShell($ADMIN_SID,"C:\Windows\explorer.exe", ($null),
($null), $restart_shell)

https://docs.microsoft.com/en-us/windows-hardware/customize/enterprise/shell-
launcher
https://docs.microsoft.com/en-us/windows/configuration/kiosk-shelllauncher

You might also like