0% found this document useful (0 votes)
114 views

Set Default Shell

This document configures and sets the Shell Launcher feature on a Windows device. It enables the Shell Launcher, sets the default shell to Explorer.exe, and sets custom shells for the "KioskMode" and "Matan" users to different executables, with restart behavior. It verifies the default shell setting and lists the current custom shell settings. Links to Microsoft documentation on Shell Launcher and kiosk mode are also included.

Uploaded by

Mato Granić
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
114 views

Set Default Shell

This document configures and sets the Shell Launcher feature on a Windows device. It enables the Shell Launcher, sets the default shell to Explorer.exe, and sets custom shells for the "KioskMode" and "Matan" users to different executables, with restart behavior. It verifies the default shell setting and lists the current custom shell settings. Links to Microsoft documentation on Shell Launcher and kiosk mode are also included.

Uploaded by

Mato Granić
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 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