How to have a Powershell script running using windows task scheduler?

bfuchs
bfuchs used Ask the Experts™
on
Hi Experts,
I have a script (.ps1) that would like to run it every 15 minutes.
When I right click and select run with powershell it runs.
However when trying to run this thru the windows task scheduler it says running, but nothing actually happens.
Perhaps I need a way to indicate it should run with PowerShell?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Application Developer
Commented:
make sure you are using powershell.exe in your actions tab when setting up the task.
Juan OcasioApplication Developer

Commented:
here is a link to what I am talking about and how to set up the argument:

https://community.spiceworks.com/how_to/17736-run-powershell-scripts-from-task-scheduler
Hi,
Will try that.
Wondering why cant I change anything under task scheduler, see screenshot how everything is disabled.
Thanks,
Ben
Untitled.png
Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

MichelangeloSystem Administrator / Postmaster

Commented:
See answers here.
https://www.experts-exchange.com/questions/29094741/Run-Exchange-Management-Shell-script-via-Task-scheduler.html

You don’t need exchange so oeave that part out. Other than that, try creating a new task or editing an existing one to get these values changed.
AndyAinscowFreelance programmer / Consultant

Commented:
>>but nothing actually happens.

Under the task scheduler the script will run as a different user.  In other words different user rights, different paths by default...  Make certain you do NOT ASSUME anything.
Juan OcasioApplication Developer

Commented:
bfuchs: right click on the task and select properties.  You should then be able to modify it.
Hi Experts,

I did what Juan suggested (see attached), and I can get it to work by right clicking and selecting run.

However when leaving it for the task scheduler to start running, it says running but nothing shows up, neither in windows bar nor under Windows task manager.

Under the task scheduler the script will run as a different user.
Well in that case It would not display running under the scheduler, besides I'm using my regular win user name pwd which has all administrator rights...

In addition, at the next time it was supposed to run, I see the following message

Task Category: Launch request ignored, instance already running
Level:         Warning
Keywords:      
User:          SYSTEM

Description:
Task Scheduler did not launch task "\DownloadFromHHAExchange"  because instance "{b42a3a34-ac36-4af4-8913-fccc119da565}"  of the same task is already running.

So this leaves me with the question, why is this showing running while nothing is happening?

Thanks,
Ben
Untitled.png

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial