Make ivisible eShell(kiosk) window on startup

Dainius 1 Reputation point
2021-06-21T09:09:38.537+00:00

Hello everyone, can't find any kind of solution, i want my batch file to start on eShell minimized or even better hidden. Here is my code at this moment:

$ShellLauncherClass = [wmiclass]"\localhost\root\standardcimv2\embedded:WESL_UserSetting"
$ShellLauncherClass.SetDefaultShell("D:\uvs\WinPOS\run.bat", 0)
$ShellLauncherClass.SetEnabled($TRUE)

Windows for IoT
Windows for IoT
A family of Microsoft operating systems designed for use in Internet of Things (IoT) devices.
382 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,364 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Ian Xue (Shanghai Wicresoft Co., Ltd.) 29,651 Reputation points Microsoft Vendor
    2021-06-22T08:15:57.023+00:00

    Hi,

    I tested the script and it worked as expected. However, you have to check if the Shell Launcher is enabled.

    function Check-ShellLauncherLicenseEnabled  
    {  
        [string]$source = @"  
    using System;  
    using System.Runtime.InteropServices;  
      
    static class CheckShellLauncherLicense  
    {  
        const int S_OK = 0;  
        public static bool IsShellLauncherLicenseEnabled()  
        {  
            int enabled = 0;  
            if (NativeMethods.SLGetWindowsInformationDWORD("EmbeddedFeature-ShellLauncher-Enabled", out enabled) != S_OK) {  
                enabled = 0;  
            }          
            return (enabled != 0);  
        }  
        static class NativeMethods  
        {  
            [DllImport("Slc.dll")]  
            internal static extern int SLGetWindowsInformationDWORD([MarshalAs(UnmanagedType.LPWStr)]string valueName, out int value);  
        }  
    }  
    "@  
        $type = Add-Type -TypeDefinition $source -PassThru  
        return $type[0]::IsShellLauncherLicenseEnabled()  
    }  
    Check-ShellLauncherLicenseEnabled  
    

    https://learn.microsoft.com/en-us/windows/configuration/kiosk-shelllauncher#configure-a-custom-shell-using-powershell
    https://learn.microsoft.com/en-us/answers/questions/222100/how-to-activate-shell-launcher.html

    Best Regards,
    Ian Xue

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments