I want to set up a task scheduler to run a PowerShell script every 1 hour with no prompt windows pop-up.
Here is the command I tried:
schtasks /create /sc hourly /tn $Task-Name /st $ScheduleTime `
/tr "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -windowstyle hidden -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -command C:\MyScript.ps1" `
I added all parameters I found.
-windowstyle hidden -NoLogo -NonInteractive -NoProfile
The script runs in the background with no problem but it still at the beginning pops up for a second before hides itself.
Does anyone know how to make a task scheduler to run the ps1 script fully hide with no pop-up windows?