Kiosk模式下的Skype for Business

时间:2016-08-30 15:46:28

标签: powershell kiosk skype-for-business

我想在Kiosk模式下运行Skype for Business,因此我使用与he相同的脚本,但我的不起作用。

我替换了以下几行:

$Cashier_SID = Get-UsernameSID("bbwallonepeop")

$ShellLauncherClass.SetCustomShell($Cashier_SID, "C:\Program Files (x86)\Microsoft Office\Office16\lync.exe", ($null), ($null), $restart_shell)

但它没有启动Skype,它也不适用于任何其他应用程序。 当我运行脚本时,我登录时唯一看到的是黑屏,然后我可以使用ctrl + alt + del启动Taskmanager,然后打开资源管理器并找到powershell exe来运行禁用脚本。

所以有一些事情发生了,explorer.exe不再启动了(即使管理员也应该启动),但Skype没有启动:/

有什么想法吗?这里是完整的脚本:

$COMPUTER = "localhost"
$NAMESPACE = "root\standardcimv2\embedded"

# Create a handle to the class instance so we can call the static methods.
$ShellLauncherClass = [wmiclass]"\\$COMPUTER\${NAMESPACE}:WESL_UserSetting"


# This well-known security identifier (SID) corresponds to the BUILTIN\Administrators group.

$Admins_SID = "S-1-5-32-544"

# Create a function to retrieve the SID for a user account on a machine.

function Get-UsernameSID($AccountName) {

    $NTUserObject = New-Object System.Security.Principal.NTAccount($AccountName)
    $NTUserSID = $NTUserObject.Translate([System.Security.Principal.SecurityIdentifier])

    return $NTUserSID.Value

}

# Get the SID for a user account named "Cashier". Rename "Cashier" to an existing account on your system to test this script.

$Cashier_SID = Get-UsernameSID("bbwallonepeop")

# Define actions to take when the shell program exits.

$restart_shell = 0
$restart_device = 1
$shutdown_device = 2

# Examples. You can change these examples to use the program that you want to use as the shell.

# This example sets the command prompt as the default shell, and restarts the device if the command prompt is closed. 

$ShellLauncherClass.SetDefaultShell("cmd.exe", $restart_device)

# Display the default shell to verify that it was added correctly.

$DefaultShellObject = $ShellLauncherClass.GetDefaultShell()

"`nDefault Shell is set to " + $DefaultShellObject.Shell + " and the default action is set to " + $DefaultShellObject.defaultaction

# Set lync/Skype for busniess as the shell for "Cashier", and restart the machine if it is closed.

$ShellLauncherClass.SetCustomShell($Cashier_SID, "C:\Program Files (x86)\Microsoft Office\Office16\lync.exe", ($null), ($null), $restart_shell)

# Set Explorer as the shell for administrators.

$ShellLauncherClass.SetCustomShell($Admins_SID, "explorer.exe")

# View all the custom shells defined.

"`nCurrent settings for custom shells:"
Get-WmiObject -namespace $NAMESPACE -computer $COMPUTER -class WESL_UserSetting | Select Sid, Shell, DefaultAction

# 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

0 个答案:

没有答案