WIN10 使用POWERSHELL 设置单应用KIOSK模式(win10家庭版或企业版)
win10 使用PowerShell 设置单应用kiosk模式
注意事项
- win10 家庭版或企业版。
- 下载安装Autologon.exe。
- Shell 启动器 v1调用的应用程序不可有黑窗(类似cmd)。
- 以下示例采用账号:
- 账户:'KIOSK'
- 密码:'KIOSK'
设置步骤
新建用户
1.进入windows设置->账户->其他用户,点击'将其他人添加到这台电脑';
2.右键用户,点击新用户,如图下操作:
下载并执行Autologon.exe:自动输入 Windows 登录用户密码
- 开启功能:输入正确账号和密码后,点击图片'Enable'。
- 关闭功能:输入正确账号后,点击图片‘Disable’。
使用 PowerShell 配置自定义 shell
新建文件'kiosk.ps1'(文件名随意)
'kiosk.ps1'文件内容
1. 文件内部关于'KIOSK'的地方都要修改成你新建用户的名称。
2. 文件内部'$ShellLauncherClass.SetCustomShell'第二个参数为调用程序的路径。
3. 文件最后有3段代表'开启','删除','禁用',需要使用其中一个功能的时候,一定要注释其他两段,如下。

- 1 # Check if shell launcher license is enabled
- 2 function Check-ShellLauncherLicenseEnabled
- 3 {
- 4 [string]$source = @"
- 5 using System;
- 6 using System.Runtime.InteropServices;
- 7
- 8 static class CheckShellLauncherLicense
- 9 {
- 10 const int S_OK = 0;
- 11
- 12 public static bool IsShellLauncherLicenseEnabled()
- 13 {
- 14 int enabled = 0;
- 15
- 16 if (NativeMethods.SLGetWindowsInformationDWORD("EmbeddedFeature-ShellLauncher-Enabled", out enabled) != S_OK) {
- 17 enabled = 0;
- 18 }
- 19
- 20 return (enabled != 0);
- 21 }
- 22
- 23 static class NativeMethods
- 24 {
- 25 [DllImport("Slc.dll")]
- 26 internal static extern int SLGetWindowsInformationDWORD([MarshalAs(UnmanagedType.LPWStr)]string valueName, out int value);
- 27 }
- 28
- 29 }
- 30 "@
- 31
- 32 $type = Add-Type -TypeDefinition $source -PassThru
- 33
- 34 return $type[0]::IsShellLauncherLicenseEnabled()
- 35 }
- 36
- 37 [bool]$result = $false
- 38
- 39 $result = Check-ShellLauncherLicenseEnabled
- 40 "`nShell Launcher license enabled is set to " + $result
- 41 if (-not($result))
- 42 {
- 43 "`nThis device doesn't have required license to use Shell Launcher"
- 44 exit
- 45 }
- 46
- 47 $COMPUTER = "localhost"
- 48 $NAMESPACE = "root\standardcimv2\embedded"
- 49
- 50 # Create a handle to the class instance so we can call the static methods.
- 51 try {
- 52 $ShellLauncherClass = [wmiclass]"\\$COMPUTER\${NAMESPACE}:WESL_UserSetting"
- 53 } catch [Exception] {
- 54 write-host $_.Exception.Message;
- 55 write-host "Make sure Shell Launcher feature is enabled"
- 56 exit
- 57 }
- 58
- 59
- 60 # This well-known security identifier (SID) corresponds to the BUILTIN\Administrators group.
- 61
- 62 $Admins_SID = "S-1-5-32-544"
- 63
- 64 # Create a function to retrieve the SID for a user account on a machine.
- 65
- 66 function Get-UsernameSID($AccountName) {
- 67
- 68 $NTUserObject = New-Object System.Security.Principal.NTAccount($AccountName)
- 69 $NTUserSID = $NTUserObject.Translate([System.Security.Principal.SecurityIdentifier])
- 70
- 71 return $NTUserSID.Value
- 72
- 73 }
- 74
- 75 # Get the SID for a user account named "KIOSK". Rename "KIOSK" to an existing account on your system to test this script.
- 76
- 77 $KIOSK_SID = Get-UsernameSID("KIOSK")
- 78
- 79 # Define actions to take when the shell program exits.
- 80
- 81 $restart_shell = 0
- 82 $restart_device = 1
- 83 $shutdown_device = 2
- 84
- 85 # Examples. You can change these examples to use the program that you want to use as the shell.
- 86
- 87 # This example sets the command prompt as the default shell, and restarts the device if the command prompt is closed.
- 88
- 89 $ShellLauncherClass.SetDefaultShell("cmd.exe", $restart_device)
- 90
- 91 # Display the default shell to verify that it was added correctly.
- 92
- 93 $DefaultShellObject = $ShellLauncherClass.GetDefaultShell()
- 94
- 95 "`nDefault Shell is set to " + $DefaultShellObject.Shell + " and the default action is set to " + $DefaultShellObject.defaultaction
- 96
- 97 # Set Internet Explorer as the shell for "KIOSK", and restart the machine if Internet Explorer is closed.
- 98
- 99 $ShellLauncherClass.SetCustomShell($KIOSK_SID, "c:\program files\internet explorer\iexplore.exe www.microsoft.com", ($null), ($null), $restart_shell)
- 100
- 101 # Set Explorer as the shell for administrators.
- 102
- 103 $ShellLauncherClass.SetCustomShell($Admins_SID, "explorer.exe")
- 104
- 105 # View all the custom shells defined.
- 106
- 107 "`nCurrent settings for custom shells:"
- 108 Get-WmiObject -namespace $NAMESPACE -computer $COMPUTER -class WESL_UserSetting | Select Sid, Shell, DefaultAction
- 109
- 110 # Enable Shell Launcher
- 111
- 112 $ShellLauncherClass.SetEnabled($TRUE)
- 113
- 114 $IsShellLauncherEnabled = $ShellLauncherClass.IsEnabled()
- 115
- 116 "`nEnabled is set to " + $IsShellLauncherEnabled.Enabled
- 117
- 118 # Remove the new custom shells.
- 119
- 120 #$ShellLauncherClass.RemoveCustomShell($Admins_SID)
- 121
- 122 #$ShellLauncherClass.RemoveCustomShell($KIOSK_SID)
- 123
- 124 # Disable Shell Launcher
- 125
- 126 #$ShellLauncherClass.SetEnabled($FALSE)
- 127
- 128 #$IsShellLauncherEnabled = $ShellLauncherClass.IsEnabled()
- 129
- 130 #"`nEnabled is set to " + $IsShellLauncherEnabled.Enabled
管理员权限执行.ps1文件
编程好.ps1文件,使用管理员权限在'powerShell'上执行该文件,显示如下结果表示成功。
用户SID查询
powerShell执行'wmic useraccount get name,sid'即可,如下。
重启开机
重启开机后,黑屏,只显示唯一调用的程序界面。
相关连接
- https://docs.microsoft.com/zh-cn/windows/configuration/kiosk-shelllauncher
- https://stackoverflow.com/questions/33364908/how-to-run-an-application-as-shell-replacement-on-windows-10-enterprise
- https://github.com/microsoft/Windows-iotcore-samples/blob/develop/Samples/ShellLauncherV2/SampleConfigXmls/README.md
WIN10 使用POWERSHELL 设置单应用KIOSK模式(win10家庭版或企业版)的更多相关文章
- WIN10 使用注册表设置单应用KIOSK模式(不限win10版本)
注意事项 下载安装Autologon.exe. 以下示例采用账号:- 账户:'KIOSK'- 密码:'KIOSK' 设置步骤 新建用户 1.进入windows设置->账户->其他用户,点击 ...
- 《连载 | 物联网框架ServerSuperIO教程》- 8.单例通讯模式开发及注意事项
1.C#跨平台物联网通讯框架ServerSuperIO(SSIO)介绍 <连载 | 物联网框架ServerSuperIO教程>1.4种通讯模式机制. <连载 | 物联网框架Serve ...
- Atitit 全屏模式的cs桌面客户端软件gui h5解决方案 Kiosk模式
Atitit 全屏模式的cs桌面客户端软件gui h5解决方案 Kiosk模式 1.1. Kiosk Software广泛用于公共电脑或者嵌入系统,最常用的就是ATM机.自动服务机之类的系统了.,1 ...
- JavaScript 设计模式之----单体(单例)模式
设计模式之--单体(单例)模式 1.介绍 从本章开始,我们会逐步介绍在JavaScript里使用的各种设计模式实现,在这里我不会过多地介绍模式本身的理论,而只会关注实现.OK,正式开始. 在传统开发工 ...
- 在Android上启用Kiosk模式
我们的云帆机器人(上面运行的安卓程序)有一个线下场景是商场,由于商场人多,总会遇到一些用户在我们的app里乱点,然后会跳出程序进入到系统设置的一些界面,这样很不友好. 比如程序中有一些需要输入文字的地 ...
- win2003设置单用户登录
远程桌面是windows操作系统中一个很方便的功能,管理测试机资产.异地排除故障等,都很快捷.在windows xp sp2模式下,一般默认是单用户登录,也就是当A用户远程一台机器时,B用户在远程到这 ...
- 选择设置好ext3日志模式
Linux是一种开放的.因Internet而产生的操作系统.Internet的发展.以网络为中心的计算模式如电子商务被迅速接受和普及,都为 Linux提供了更巨大的机会,使之成为企业和部门级的首选平台 ...
- [OpenStack] [Liberty] Neutron单网卡桥接模式访问外网
环境配置: * Exsi一台 * Exsi创建的单网卡虚拟机一台 * Ubuntu 14LTS 64位操作系统 * OpenStack Liberty版本 * 使用Neutron网络而非Nova网络 ...
- ccflow_005.请假流程-傻瓜表单-审核组件模式
ccflow_005.请假流程-傻瓜表单-审核组件模式 ' 用审核组件演示各个流程应用 首先设置节点,填写请假单的 表单方案.选择内置傻瓜表单.我们之前创建的表单就回来了. 可以点击下面的设计傻瓜表单 ...
随机推荐
- short s1 = 1; s1 = s1 + 1;有错吗?short s1 = 1; s1 += 1;有错吗?
对于short s1 = 1; s1 = s1 + 1;由于1是int类型,因此s1+1运算结果也是int 型,需要强制转换类型才能赋值给short型.而short s1 = 1; s1 += 1;可 ...
- 什么是 Spring Cloud Bus?我们需要它吗?
考虑以下情况:我们有多个应用程序使用 Spr ng Cloud Config 读取属性,而S ring Cloud Config 从GIT 读取这些属性. 下面的例子中多个员工生产者模块从 Employe ...
- SqlMapConfig.xml文件详解
SqlMapConfig.xml 是 mybatis 的全局配置文件,配置内容如下: properties(属性) settings(全局配置参数) typeAliases(类型别名) typeHan ...
- Spring与Web项目整合的原理
引言: 在刚开始我们接触IOC时,我们加载并启用SpringIOC是通过如下代码手动加载 applicationContext.xml 文件,new出context对象,完成Bean的创建和属性的注入 ...
- 学习zabbix(四)
一. 监控知识 1.硬件监控: 机房巡检,远程控制卡,IPMI 2.系统监控: cpu负载查看(指标):uptime(低于3),top(30%-70%), vmstat, mpstat 内存监控: f ...
- STM32 之 HAL库(固件库)
1 STM32的三种开发方式 通常新手在入门STM32的时候,首先都要先选择一种要用的开发方式,不同的开发方式会导致你编程的架构是完全不一样的.一般大多数都会选用标准库和HAL库,而极少部分人会通过直 ...
- 如何更愉快地使用rem —— 别说你懂CSS相对单位
前段时间试译了Keith J.Grant的CSS好书<CSS in Depth>,其中的第二章<Working with relative units>,书中对relative ...
- 7步学会在Windows下上架iOS APP流程
之前用跨平台开发工具做了一个应用,平台可以同时生成安卓版和苹果版,想着也把这应用上架到App Store试试,于是找同学借了个苹果开发者账号,但没那么简单,还要用到Mac电脑的钥匙串申请发布证书和上传 ...
- 【Android开发】Android6.0请求权限方式
记录一下最普通的动态请求权限的方法: private int requestCode == 123; //判断当前系统的版本 if(Build.VERSION.SDK_INT >= 23){ i ...
- 大数据学习之路之sqoop导入
按照网上的代码导入 hadoop(十九)-Sqoop数据清洗 - 简书 (jianshu.com) ./sqoop import --connect "jdbc:mysql://192.16 ...