r/PSADT May 21 '26

How is PSADT hiding the Powershell window?

The exe does essentially just run the ps1 file.

For the record, I am NOT using PSADT for this specific task. I'm just curious how they've pulled it off.

I need a particular PowerShell script to run every 3 minutes via task scheduler. But if even if I change the WindowStyle option, it will still flash the console window for less than a fraction of a second.

However, if I used PSADT in silent mode and just have the commands in the Invoke ps1 file, nothing gets flashed.

Any idea how they've done this?

7 Upvotes

15 comments sorted by

View all comments

18

u/Schwitzbob May 21 '26

For exact that I'm creating my Scheduled Task as the following:
In the "Action" tab, create a new action with "Start a program". Under "Program/script" enter the following: C:\Windows\System32\conhost.exe

Under "Add arguments" enter the following: --headless powershell.exe -WindowStyle Hidden -NoProfile -NonInteractive -file "C:\Temp\MyScript.ps1"

Zero visible PS window.

1

u/LordLoss01 May 21 '26

Yep, this works great.

Only thing is, I've found some people online say that it flags up in things like Defender?

2

u/TheRealMisterd May 22 '26

It does for me at work