mikedopp

Open_Shell.ps1

Feb 6th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Create a handle to the class instance so we can call the static methods.
  2. $ShellLauncherClass = [wmiclass]"\\localhost\root\standardcimv2\embedded:WESL_UserSetting"
  3.  
  4. function Get-UsernameSID($AccountName) {
  5.     $NTUserObject = New-Object System.Security.Principal.NTAccount($AccountName)
  6.     $NTUserSID = $NTUserObject.Translate([System.Security.Principal.SecurityIdentifier])
  7.     return $NTUserSID.Value
  8. }
  9.  
  10. # This well-known security identifier (SID) corresponds to the BUILTIN\Administrators group.
  11. $Admins_SID = "S-1-5-32-544"
  12.  
  13. # Name of Kiosk account
  14. $Kiosk_SID = Get-UsernameSID("KiOSK")
  15.  
  16. # Define actions to take when the shell program exits.
  17. $restart_shell = 0
  18. $restart_device = 1
  19. $shutdown_device = 2
  20.  
  21. # Remove the new custom shells.
  22.  
  23. $ShellLauncherClass.RemoveCustomShell($Admins_SID)
  24.  
  25. $ShellLauncherClass.RemoveCustomShell($Kiosk_SID)
  26.  
  27. # Enable Shell Launcher
  28. $ShellLauncherClass.SetEnabled( 1 )
  29.  
  30. # Set the custom shell for the kiosk, and restart the shell if it's closed.
  31. $ShellLauncherClass.SetCustomShell($Kiosk_SID, "C:\Program Files (x86)\Omnivex\Moxie\Player\Omnivex Moxie Player.exe", ($null), ($null), $restart_shell)
  32.  
  33. # Set the admin's shell to Explorer
  34. $ShellLauncherClass.SetCustomShell($Admins_SID, "explorer.exe")
Add Comment
Please, Sign In to add comment