user952342
user952342

Reputation: 2742

Powershell: Scheduled task running script in background instead of foreground

I am using windows "scheduled tasks" to run a powershell script with parameters.

For some reason it is executing in the background rather than the foreground. I want to be able to see it executing... it takes over 1 hour to finish and I want to watch its progress.

Thanks

Upvotes: 2

Views: 5592

Answers (2)

AvkashChauhan
AvkashChauhan

Reputation: 20556

Is it Windows Server or Windows 7 machine?

In Windows Sever task scheduler launches application in no user mode (unless specified in policy) versus, Windows 7 the scheduler launching application in system account. This could be reason for Windows is hidden.

Also if you script take an hour to run showing PS window is not a great idea, instead you can route your PS output to a text file and check the file details to monitor the progress when needed.

Upvotes: 4

BartekB
BartekB

Reputation: 8650

Two possible reasons that I can think of:

  • "Run whether user is logged on or not" option selected
  • paramete -WindowStyle Hidden on powershell.exe specified.

If neither is the case, than I don't know what may be the reason. Maybe some other script element that hides PowerShell window?

Upvotes: 4

Related Questions