我需要在运行Windows 10 Enterprise的计算机上创建一个特殊帐户.该帐户将直接在登录时启动应用程序,而不是默认的shell,并退出应用程序应强制重新启动计算机.
我可以在Windows 8.1 Embedded Industry Pro上使用配置控制台和锁定功能轻松实现.
现在,在Windows 10上,我尝试遵循关于technet WESL_UserSetting和Set up a kiosk on Windows 10 Pro,Enterprise,or Education的两个教程
但是,这两个教程都不行.我设法执行其中描述的脚本,但它们没有任何效果(我已经修改它们,因此它们不会删除shell集).
最后我结束了以下代码:
$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),$restart_device) "`nCurrent settings for custom shells:" Get-WmiObject -namespace $NAMESPACE -computer $COMPUTER -class WESL_UserSetting | Select Sid,Shell,DefaultAction
在admin powershell中执行此脚本会产生所需的输出:
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
但是,“cmp”用户只需显示标准的Windows 10 shell即可.
为了能够运行程序而不是标准的shell,我应该改变什么?