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

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?
LVL 6
bfuchsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Juan OcasioApplication DeveloperCommented:
make sure you are using powershell.exe in your actions tab when setting up the task.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Juan OcasioApplication DeveloperCommented:
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
bfuchsAuthor Commented:
Hi,
Will try that.
Wondering why cant I change anything under task scheduler, see screenshot how everything is disabled.
Thanks,
Ben
Untitled.png
Active Protection takes the fight to cryptojacking

While there were several headline-grabbing ransomware attacks during in 2017, another big threat started appearing at the same time that didn’t get the same coverage – illicit cryptomining.

MichelangeloConsultantCommented:
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 / ConsultantCommented:
>>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 DeveloperCommented:
bfuchs: right click on the task and select properties.  You should then be able to modify it.
bfuchsAuthor Commented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.