Joz*_*ény 20 windows shell powershell windows-10
我需要在运行Windows 10 Enterprise的计算机上创建一个特殊帐户.此帐户将直接在登录时启动应用程序而不是默认shell,退出应用程序应强制计算机重新启动.
我能够使用配置控制台和锁定功能在Windows 8.1 Embedded Industry Pro上轻松完成此操作.
现在,在Windows 10上,我尝试按照technet上的两个教程WESL_UserSetting并在Windows 10 Pro,Enterprise或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), ($null), $restart_device)
"`nCurrent settings for custom shells:"
Get-WmiObject -namespace $NAMESPACE -computer $COMPUTER -class WESL_UserSetting | Select Sid, Shell, DefaultAction
Run Code Online (Sandbox Code Playgroud)
在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
Run Code Online (Sandbox Code Playgroud)
但是,以'cmp'用户身份登录只会显示标准的Windows 10 shell.
为了能够运行程序而不是标准shell,我应该更改什么?
Ste*_*rka 12
我现在遇到了同样的问题.是的,微软已经改变了更换外壳的方法.您可以安装和使用Embedded Shell Launcher根据自助服务终端模式自定义窗口.但这仅适用于企业和教育.
如果您不想购买企业版,您可以使用HKCU和HKLM中已知的注册表位置.https://msdn.microsoft.com/en-us/library/ms838576(v=WinEmbedded.5).aspx
但是等等,哦,不,因为Windows 10只能使用Microsoft签名的应用程序,所以你的普通.net应用程序没有启动,登录后屏幕仍然是黑屏.但我们已经找到了解决方法.
只需使用批处理文件作为自举.如果您将注册表项设置为批处理文件,批处理文件启动实际应用程序,那么它就像一个魅力.
@echo off
echo Bootstrapping, please wait ...
start /b "Bootstrap" "C:\vmwatcher\VMViewClientWatcher.exe"
Run Code Online (Sandbox Code Playgroud)
小智 7
您是否尝试过更改用户shell?
https://msdn.microsoft.com/en-us/library/ms838576(v=WinEmbedded.5).aspx
您需要设置一些注册表项.第一个允许为用户提供唯一的shell,第二个定义启动而不是资源管理器的可执行文件.
我想做类似的事情,我从其他答案中大量借用,但对我来说,没有一个是完全可行的答案。这就是我最终要做的。
Run Code Online (Sandbox Code Playgroud)set oShell=createobject("wscript.shell") sCmd="d:\launchbox\launchbox.exe" oShell.run sCmd,,true 'true forces it to wait for process to finish sCmd="shutdown /r /t 0" oShell.run sCmd
以新用户身份登录
运行regedit
将名为Shell的新字符串值添加到HKEY_Current_User \ Software \ Microsoft \ Windows NT \ CurrentVersion \ Winlogon,其中包含执行脚本所需的命令值:
Run Code Online (Sandbox Code Playgroud)wscript d:\launchbox\launch.vbs
| 归档时间: |
|
| 查看次数: |
45113 次 |
| 最近记录: |