簡體   English   中英

如何在 Windows 10 企業版上運行應用程序作為外殼替換

[英]How to run an application as shell replacement on Windows 10 Enterprise

我需要在運行 Windows 10 Enterprise 的計算機上創建一個特殊帳戶。 此帳戶將在登錄時直接啟動應用程序而不是默認 shell,退出應用程序應強制計算機重新啟動。

我能夠使用配置控制台和鎖定功能在 Windows 8.1 Embedded Industry Pro 上輕松完成此操作。

現在,在 Windows 10 上,我嘗試遵循 technet WESL_UserSetting在 Windows 10 專業版、企業版或教育版上設置信息亭上的兩個教程

但是,這兩個教程都不起作用。 我已經設法執行其中描述的腳本,但它們沒有任何效果(我已經修改了它們,因此它們不會刪除 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

在管理 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。

為了能夠運行程序而不是標准外殼,我應該更改什么?

我現在遇到了同樣的問題。 是的,微軟已經改變了進行外殼替換的方式。 您可以安裝和使用 Embedded Shell Launcher 來根據自己的喜好為 kiosk 模式自定義窗口。 但這僅適用於企業和教育。

如果您不想購買企業版,您可以使用 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"

您是否嘗試過更改用戶外殼?

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

您需要設置一些注冊表項。 第一個能夠為用戶提供獨特的 shell,第二個定義啟動的可執行文件而不是資源管理器。

我想做類似的事情,我從其他答案中大量借鑒,但對我來說,沒有一個是完整的工作答案。 這就是我最終做的。

  1. 創建一個新的用戶帳戶
  2. 設置以下 vbs 腳本(主要受此線程啟發)以啟動 shell 應用程序並將其命名為“launch.vbs”
 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
  1. 以新用戶身份登錄

  2. 運行注冊表

  3. 將名為 Shell 的新字符串值添加到 HKEY_Current_User\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon 中,並使用您需要運行以執行腳本的命令的值:

 wscript d:\\launchbox\\launch.vbs
  1. 注銷並以用戶身份重新登錄以查看其運行情況

我自己和這個斗爭過。 如果您查看 Windows 10 Shell Launcher 的說明,它僅適用於企業版或教育版。 如果您嘗試在 Home 或 Pro 版本中使用它,它只會啟動到一個空白屏幕。 在企業中使用相同的腳本,我確認工作完美......

我認為您為用戶正確設置了自定義 shell,但也許您需要激活 ShellLauncher 行為。 試試這個(在你的腳本末尾):

$ShellLauncherClass.SetEnabled($TRUE)

這樣,當您使用其他帳戶登錄時,不會啟動標准的 Windows 10 shell,但是(至少在我的情況下)命令行不會啟動,結果是黑屏。

您仍然可以運行任務管理器並從那里運行新任務,但我不明白為什么命令行不會自動啟動。

我遇到了同樣的問題,那是因為TechNet 中關於如何配置 ShellLauncher 的腳本實際上啟用了,然后禁用了同一個 Shell!

# Enable Shell Launcher

$ShellLauncherClass.SetEnabled($TRUE)

$IsShellLauncherEnabled = $ShellLauncherClass.IsEnabled()

"`nEnabled is set to " + $IsShellLauncherEnabled.Enabled

# Remove the new custom shells.

$ShellLauncherClass.RemoveCustomShell($Admins_SID)

$ShellLauncherClass.RemoveCustomShell($Cashier_SID)

# Disable Shell Launcher

$ShellLauncherClass.SetEnabled($FALSE)

$IsShellLauncherEnabled = $ShellLauncherClass.IsEnabled()

"`nEnabled is set to " + $IsShellLauncherEnabled.Enabled

我只是懶洋洋地復制和粘貼代碼,並希望它能夠工作。

如果您注釋掉最后十行,則此過程起作用。

記住孩子們:不要只是復制和粘貼陌生人的代碼!

我的拳頭試圖幫助我收到很多的地方。 不是一個完整的答案,但可能足以讓您到達目的地。 這適用於我的“Kiosk”應用程序,該應用程序位於“我的”Windows 10 Enterprise 系統上,該系統專為我的應用程序構建。 它會將您的“shell”設置為在系統啟動時啟動,然后啟動您的 click once 程序。 希望這可以幫助。

Imports System.Threading

Public Class Form1

# Path to your ClickOnce app
Dim startPath As String = Environment.GetFolderPath(Environment.SpecialFolder.Programs) _
& '"\"' & '"remaining path to your app"' & '".appref-ms"'

# Path to your shell which is also a clickonce app(this one)

Dim spath As String = Application.StartupPath & '"\"' & My.Application.Info.AssemblyName _
& '".exe"'

# This sets the registry to start your shell which in turn starts your app. 
# I did this so that if the app is closed, they see the shell background.
# You can add controls to your shell to restart the app, shutdown.... 
#Just be cautious, make sure your app is 100% done and updates on it's own before you 
# disable the ability to get back to windows explorer.
# Other wise you could have a very bad day.

My.Computer.Registry.SetValue('"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\ _
CurrentVersion\Winlogon"', '"Shell"', spath)


Thread.Sleep(500)

Process.Start(startPath)

End Class

我想首先為評論一個非常舊的線程而道歉。

在過去的 6 個月里,我一直在努力讓自定義應用程序作為默認 shell 運行,並保留管理員權限。 像許多人一樣,這些腳本和/或命令不起作用,我需要一些快速、有效和簡單的東西!

只需將“explorer.exe”(HKLM\\SOFTWARE\\Microsoft\\Window NT\\Winlogon\\Shell)替換為自定義應用程序位置即可提供黑屏。

一種更簡單且效果很好的方法是創建一個 BATCH 腳本以通過提升的 powershell 調用自定義應用程序...

powershell -nologo -noprofile -executionpolicy bypass -command "start-process -verb 'runas' -filepath <full path of custom app executable>"

通過使用此批處理腳本替換“explorer.exe”,我能夠在 Windows 10 PRO 下使用非 UWP 應用成功創建自助服務終端樣式鎖定。

您可以使用 Windows 配置設計器創建預配包。 當您選擇“提供自助服務終端設備”時,gui 將有助於創建一個簡單的外殼替換

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM