title: How to run an application as shell replacement on Windows 10 Enterprise
body: <p>I need to create a special account on a computer running Windows 10 Enterprise. This account would launch an application directly on login instead of the default shell and exiting the application should force the computer to restart.</p>
  
  <p>I was able to do this easily on Windows 8.1 Embedded Industry Pro using the configuration console and lockdown features.</p>
  
  <p>Now, on Windows 10 I try to follow the two tutorials on technet <a href="https://msdn.microsoft.com/en-us/library/windows/hardware/mt620048(v=vs.85).aspx" rel="noreferrer">WESL_UserSetting</a> and <a href="https://technet.microsoft.com/en-us/library/mt219051(v=vs.85).aspx#set_up_assigned_access_using_imaging_and_configuration_designer" rel="noreferrer">Set up a kiosk on Windows 10 Pro, Enterprise, or Education</a></p>
  
  <p>However, neither of the tutorials work. I have managed to execute the scripts described in them but they have no effect (I've modified them so they do not remove the shells set).</p>
  
  <p>Finally I've ended up with the following code:</p>
  
  <pre><code>$COMPUTER = "localhost"
  $NAMESPACE = "root\standardcimv2\embedded"
  $ACCOUNT_NAME = "cmp"
  
  $ShellLauncherClass = [wmiclass]"\\$COMPUTER\${NAMESPACE}:WESL_UserSetting"
  
  
  $NTUserObject = New-Object System.Security.Principal.NTAccount($ACCOUNT_NAME)
  $NTUserSID = $NTUserObject.Translate([System.Security.Principal.SecurityIdentifier]).Value
  
  $NTUser_Shell = Get-WmiObject -namespace $NAMESPACE -computer $COMPUTER -class WESL_UserSetting | 
      where {$_.Sid -eq $NTUserSID}
  
  if ($NTUser_Shell) {
      "`Custom shell already set for [$ACCOUNT_NAME] removing it"
      $ShellLauncherClass.RemoveCustomShell($NTUserSID)
  }
  
  $restart_shell = 0
  $restart_device = 1
  $shutdown_device = 2
  
  $ShellLauncherClass.SetCustomShell($NTUserSID, "cmd.exe", ($null), ($null), $restart_device)
  
  "`nCurrent settings for custom shells:"
  Get-WmiObject -namespace $NAMESPACE -computer $COMPUTER -class WESL_UserSetting | Select Sid, Shell, DefaultAction
  </code></pre>
  
  <p>Executing this script in an admin powershell produces the desired output:</p>
  
  <pre><code>Custom shell already set for [cmp] removing it
  
  Current settings for custom shells:
  
  Sid                                            Shell   DefaultAction
  ---                                            -----   -------------
  S-1-5-21-3842421150-1098587697-2315725148-1002 cmd.exe             1
  </code></pre>
  
  <p>However logging as the 'cmp' user simply shows the standard Windows 10 shell.</p>
  
  <p>What should I change in order to be able to run a program instead of a standard shell?</p>