I need to run a PowerShell script scheduled task every hour with no pop-up window.
Here is the command:
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 but at the beginning displays a window before hiding itself.
How can I run the task with no pop-up windows?