r/PowerShell • • Feb 20 '26

Run powershell without terminal window

How to run ps1 script without the terminal window showing up at all?

Using -WindowStyle Hidden still shows the terminal for a moment. Minimising to tray is also not the solution i am looking for.

I saw there are external tools but they are a potential security risk.

The only way I found that works is using vbs and disabled the console window inside it. However, vbs has some other issue, and is deprecated by Microsoft currently, so i would rather find another way.

So, are there any other solutions?

Edit:

It seems that running ps1 by using conhost is the solution i needed.

conhost --headless powershell -File script.ps1 ...

56 Upvotes

28 comments sorted by

View all comments

Show parent comment

1

u/quantgorithm Sep 01 '26

Op didn't say he needed to interact. Also OP inserted his answer in the thread message.

1

u/ngt500 Sep 01 '26

Just adding context to the discussion. The workaround of running as a different user to avoid a window will only work if you don't need access to the current user session. Given that there are alternatives without that limitation it makes sense to point it out.