- $COMPUTER = "localhost"
+```
+ $COMPUTER = "localhost"
$NAMESPACE = "root\standardcimv2\embedded"
-# Create a handle to the class instance so we can call the static methods.
+ # 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.
+ # 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.
+ # Create a function to retrieve the SID for a user account on a machine.
function Get-UsernameSID($AccountName) {
@@ -319,56 +313,53 @@ Alternatively, you can turn on Shell Launcher using the Deployment Image Servici
}
-# 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")
-# Define actions to take when the shell program exits.
+ # Define actions to take when the shell program exits.
$restart_shell = 0
$restart_device = 1
$shutdown_device = 2
-# Examples
+ # Examples
-# Set the command prompt as the default shell, and restart the device if it's closed.
+ # Set the command prompt as the default shell, and restart the device if it's closed.
$ShellLauncherClass.SetDefaultShell("cmd.exe", $restart_device)
-# Display the default shell to verify that it was added correctly.
+ # 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 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)
-# Set Explorer as the shell for administrators.
+ # Set Explorer as the shell for administrators.
$ShellLauncherClass.SetCustomShell($Admins_SID, "explorer.exe")
-# View all the custom shells defined.
+ # 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
+ # Enable Shell Launcher
$ShellLauncherClass.SetEnabled($TRUE)
"`nEnabled is set to " + $DefaultShellObject.IsEnabled()
-# Remove the new custom shells.
+ # Remove the new custom shells.
$ShellLauncherClass.RemoveCustomShell($Admins_SID)
$ShellLauncherClass.RemoveCustomShell($Cashier_SID)
-
|
-
-