fixed Powershell script conversion issue

This commit is contained in:
Brian Lich
2016-04-21 15:33:00 -07:00
parent cadef2063b
commit 537ac829d8

View File

@ -291,16 +291,16 @@ Alternatively, you can turn on Shell Launcher using the Deployment Image Servici
Modify the following PowerShell script as appropriate and run the script on the kiosk device.
```
$COMPUTER = "localhost"
$NAMESPACE = "root\standardcimv2\embedded"
$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"
$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"
$Admins_SID = S-1-5-32-544
# Create a function to retrieve the SID for a user account on a machine.
@ -310,12 +310,12 @@ Modify the following PowerShell script as appropriate and run the script on the
$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.
# 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("Cashier")
$Cashier_SID = Get-UsernameSID(Cashier)
# Define actions to take when the shell program exits.
@ -327,32 +327,32 @@ Modify the following PowerShell script as appropriate and run the script on the
# Set the command prompt as the default shell, and restart the device if it's closed.
$ShellLauncherClass.SetDefaultShell("cmd.exe", $restart_device)
$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
`nDefault Shell is set to + $DefaultShellObject.Shell + and the default action is set to + $DefaultShellObject.defaultaction
# Set Internet Explorer as the shell for "Cashier", and restart the machine if it's closed.
# Set Internet Explorer as the shell for “Cashier”, and restart the machine if it's closed.
$ShellLauncherClass.SetCustomShell($Cashier_SID, "c:\program files\internet explorer\iexplore.exe www.microsoft.com", ($null), ($null), $restart_shell)
$ShellLauncherClass.SetCustomShell($Cashier_SID, c:\program files\internet explorer\iexplore.exe www.microsoft.com, ($null), ($null), $restart_shell)
# Set Explorer as the shell for administrators.
$ShellLauncherClass.SetCustomShell($Admins_SID, "explorer.exe")
$ShellLauncherClass.SetCustomShell($Admins_SID, explorer.exe)
# View all the custom shells defined.
"`nCurrent settings for custom shells:"
`nCurrent settings for custom shells:
Get-WmiObject -namespace $NAMESPACE -computer $COMPUTER -class WESL_UserSetting | Select Sid, Shell, DefaultAction
# Enable Shell Launcher
$ShellLauncherClass.SetEnabled($TRUE)
"`nEnabled is set to " + $DefaultShellObject.IsEnabled()
`nEnabled is set to + $DefaultShellObject.IsEnabled()
# Remove the new custom shells.