How do I run a powershell script as a task in task scheduler?

I have a password reset script (passwordexpire.ps1) that works perfectly whenever I r-click and 'run using powershell'.
However, I wish to automate this daily task and my attempts to set it up in task Scheduler on the DC fails to run. I see the task steps are created and given process IDs in the 'history' tab, all as completed, but nothing results from it running.

Does anyone have some steps I can follow to make this work? I've read that configuring the location of where it starts is something to be modified when using .ps1 files but have not found anything else.

Server 2008 R2 standard.
The script is a simple notepad file renamed as .ps1
LVL 14
Michael MachieFull-time technical multi-taskerAsked:
Who is Participating?
 
KimputerConnect With a Mentor Commented:
executable: powershell
arguments:  -ExecutionPolicy RemoteSigned -File C:\scripts\script.ps1
0
 
Hello ThereSystem AdministratorCommented:
It's easy.

Just create a new task that will run Powershell under admin account and then in Arguments field write the path to your .ps1 script.

More here.
0
 
Hello ThereSystem AdministratorCommented:
Yes, you have to specify full argument.
0
Protect Your Employees from Wi-Fi Threats

As Wi-Fi growth and popularity continues to climb, not everyone understands the risks that come with connecting to public Wi-Fi or even offering Wi-Fi to employees, visitors and guests. Download the resource kit to make sure your safe wherever business takes you!

 
Michael MachieFull-time technical multi-taskerAuthor Commented:
Thanks to both. Points awarded based on the below explanation..

Kimputer provided the exact arguments needed, which worked, without going to an external site so gets the Accept.

B A's link in the post provided a step-by-step instruction list, but from an external source, and since that is against E-E TOS I cannot grant points because when the link goes dead (and they usually do, hence the E-E TOS statement about external sites) I cannot Accept and lead future people to a dead link.
0
 
Hello ThereSystem AdministratorCommented:
Well, I take that. Just realize that I put some effort to answer you and as far as my answer is correct too, you should let others know...
0
 
Michael MachieFull-time technical multi-taskerAuthor Commented:
Hi, i didnt ever see the name Hello There next to any comments. I only saw B A and Kimputer. Looking nkw i do mot see a B A and  now see a Hello There.

Not sure if that is the reason why i didnt mention your name but it may be.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.