Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window blip even with -noconsole switch #143

Open
dotbmcwhorter opened this issue Feb 21, 2025 · 3 comments
Open

Window blip even with -noconsole switch #143

dotbmcwhorter opened this issue Feb 21, 2025 · 3 comments

Comments

@dotbmcwhorter
Copy link

dotbmcwhorter commented Feb 21, 2025

Hey Team! Great cmdlet! At least in Win11 (does not appear to be happening on Win10 machines), even with -noconsole specified, we still get a very very fast (but users are noticing and opening tickets) window that flashes. I assume this may be due to our .Net core version 8.0.1x, but not 100% sure. Hoping to get a quick fix before we're told to punt this solution to C#. Thanks!

@MScholtes
Copy link
Owner

Hello @dotbmcwhorter,

I made several tests against Windows 11 and can not replicate the issue you are experiencing.

  • does this happen to every script? (To test you can make a script with one line: "Start-Sleep 10" and compile with -noconsole, this script does nothing but wait for 10 seconds)
  • can you test with the additional parameters -nooutput and -noerror?
  • does the additional window start too when you call "powershell.exe exit" and "powershell.exe -NoProfile exit" in an existing cmd/powershell/terminal window?

What Windows version you are using (please use the values given by WinVer.exe)?

Greetings

Markus

@MScholtes
Copy link
Owner

P.S.:
With the additional parameter -prepareDebug PS2EXE writes the C# source file in the current directory. You might compile this by yourself to see what changes. But remember, the C# code is for .Net Framework 4.

@dotbmcwhorter
Copy link
Author

Hello @dotbmcwhorter,

I made several tests against Windows 11 and can not replicate the issue you are experiencing.

* does this happen to every script? (To test you can make a script with one line: "**_Start-Sleep 10_**" and compile with **-noconsole**, this script does nothing but wait for 10 seconds)

* can you test with the additional parameters **-nooutput** and **-noerror**?

* does the additional window start too when you call "**_powershell.exe exit_**" and "**_powershell.exe -NoProfile exit_**" in an existing cmd/powershell/terminal window?

What Windows version you are using (please use the values given by WinVer.exe)?

Greetings

Markus

Markus, greatly appreciate your reply and efforts!

WinVer shows 24H2 26100.1742

No window pop on powershell -exit nor if I convert Start-Sleep 10 to exe and run it.

Thanks to your inquiry, looks like if I remove my code that checks whether the user is at lock screen, the window goes away.

Culprit:
$locked=(quser 2>$null) -and (get-process logonui -ea 0)

Maybe I can find a different set of commands to check for this that handles things better. So weird it doesn't pop on Win10, but does so on Win11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants