加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

如何在Windows 10 Enterprise上运行应用程序作为shell替换

发布时间:2020-12-13 20:21:59 所属栏目:Windows 来源:网络整理
导读:我需要在运行Windows 10 Enterprise的计算机上创建一个特殊帐户.该帐户将直接在登录时启动应用程序,而不是默认的shell,并退出应用程序应强制重新启动计算机. 我可以在Windows 8.1 Embedded Industry Pro上使用配置控制台和锁定功能轻松实现. 现在,在Windows
我需要在运行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 = "rootstandardcimv2embedded"
$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,我应该改变什么?

你试过改变用户shell吗?

https://msdn.microsoft.com/en-us/library/ms838576(v=WinEmbedded.5).aspx

您需要设置几个注册表项.第一个能够给用户一个唯一的shell,第二个定义了可执行文件,而不是浏览器.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读