익명 06:19

Windows 10 Task Scheduler run PowerShell with no pop-up window

Windows 10 Task Scheduler run PowerShell with no pop-up window

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?



Top Answer/Comment:

Thank you, JosefZ for solution!

Here is an example of VBS script.

' run_hidden.vbs
Set objShell = CreateObject("WScript.Shell")
objShell.Run "powershell.exe -ExecutionPolicy Bypass -File ""C:\path\to\script.ps1""", 0, False

create script and add it to Start Program action.

  • program: wscript.exe
  • argument: "C:\path\to\run_hidden.vbs"
상단 광고의 [X] 버튼을 누르면 내용이 보입니다