We help IT Professionals succeed at work.
Get Started

PowerShell and Task Scheduler

1,357 Views
Last Modified: 2016-03-15
On my Windows 2012 R2 server when I set the task to run my Powershell script with the "Run if user is logged in or not" and have the "Run with elevated permissions" the task does not run and get a (0x1) message. If I copy and paste the syntax into powershell it works fine.

Questions
1) Is see a number of post out there regarding the (0x1) exit code with Powershell and Task Scheduler. What is the trick to get this to work
2) My script geneates a CSV's file in a specific location. Will this be automatically over written daily?
3) What would be the easiest way to have all CSV files emailed to me? I believe powershell does have a send mail commandlet but have not used it before
Comment
Watch Question
"Batchelor", Developer and EE Topic Advisor
CERTIFIED EXPERT
Top Expert 2015
Commented:
This problem has been solved!
Unlock 1 Answer and 47 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE