Windows – Powershell Task Scheduler Stuck Running

powershelltasktaskschedulerwindows

I was trying to test a simple powershell script with task scheduler, the status showed running but the powershell console never showed up.

My ps1 script just contains two simple commands:

  • dir
  • pause

Here is my setup:

General

  • Run whether user is logged on or not (check)
  • Run with highest privileges (check)

Actions

  • Action: Start a program
  • Program/Script: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
  • Add arguments (optional): -file E:\iQ_Schedule\Untitled1.ps1

This setup works on other computer (Windows 10) but just won't on this one (Windows Server 2012 R2). I am not sure why.

Best Answer

Welcome to Session 0 isolation mode.

When you run your task with "Run whether user logged in or not", it runs in so called session 0. You can check this with your task manager.

enter image description here enter image description here

Tasks running is Session 0 has restrictions on showing the user interface

Related Topic