Make ivisible eShell(kiosk) window on startup

Hello everyone. I can’t find any kind of solution for me to work.
I want my file to start on eShell minimized or even better hidden.
Code that i have at this moment

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

Dainius,
Welcome to the forum.

When you crosspost the same question at the same time to different forums you should at least post links to the other forums along with your question to avoid people willing to help you making their work twice or more.

Thanks in advance

https://stackoverflow.com/questions/68065458/make-invisible-eshellkiosk-window-on-startup

Regardless of that … you may ask a specific question about the code you posted. :wink:

And last but not least … when you post code, error messages, console output or sample data you should format it as code using the “preformatted text” button ( </> ). :wink:

Hello,

And thank you for your comments, will try my best for the future posts ! :slight_smile:

Found this VBScipt that helps to hide the window, but can i implement it to the existing powershell command that i have ?

Set WshShell = CreateObject("WScript.Shell") 
WshShell.Run chr(34) & "D:\UVS\WinPOS\run.bat" & Chr(34), 0
Set WshShell = Nothing

As far as I know VBScript is specific to Windows systems and I understood that eShell is specific to linux. So I doubt that it will be possible to use this in this case.

It’s really not clear what you’re trying to do here.

You can start PowerShell with a hidden window using the -windowStyle parameter:

powershell.exe -windowStyle hidden

If you call your batch file from that, you shouldn’t see a window.

If you’re actually calling your PS from a batch file, or if you’re using VBScript to call your batch file then, instead of calling the batch file directly, create a shortcut to the batch file. Modify the shortcut properties to run minimised, then call the shortcut file instead of the batch file.

Ok so I have googled a bit more, so my my powershell script just enables eShell, that can be done through regedit. So it mainly just launches my run.bat. The thing is I need that run.bat to launch minimized or invisible without any additional .bat or .vbs scripts

OK, so I would try making a shortcut to run.bat
Edit the shortcut (right click | properties) and on the Shortcut tab, set the Run field to Minimised.
In your PowerShell script, replace ‘run.bat’ with ‘run - shortcut.lnk’ (assuming you didn’t rename it).

Tried that, this way eShell doesn’t see the .lnk file and the screen just remains black and dones’t launch anything as it should.

What is in run.bat?

I can’t really offer you much more help as I don’t have an equivilent configuration to test with.

However, skimming the documents, I note this:

You cannot use the following executable as a custom shell: C:\\Windows\\System32\\Eshell.exe . Using Eshell.exe as the default shell will result in a blank screen after user signs in.

From here:

And this:

Shell Launcher doesn’t support a custom shell with an application that launches a different process and exits.

From here:

You cannot use the following executable as a custom shell: C:\\Windows\\System32\\Eshell.exe . Using Eshell.exe as the default shell will result in a blank screen after user signs in.

This is exactly why we are using eshell because we need to hide the desktop from the user.

The run.bat inside has a script that launches an application and relaunches it after you kill it or it crashes.

Ok so solution was best to implement the -WindowStyle -Minimized implemented into the shell script.

Full code:

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