0

I am trying to schedule a task which runs a powershell script. This script copy several files from one server to the one which the script is running.

If i run the script with an elevated powershell prompt it is working like a charme. When I create a scheduled task with the same user as I used for running manual directly, the script isn't working anymore because the script isn't able to find the folders. Oddly enough there is no error shown in the task scheduler.

If I log on to the system with the same user, there are no problems connecting the shares.

We have allready tried to permit the user same like our domain admin. Still no luck.

My guess is there is something in the security policy wrong. We allready set the logon as a batch job and the log on locally policy.

Any suggestions?

5
  • Do you have the check mark for "Run with highest privileges" checked? Are you using a drive letter or a UNC path? I've had better results using a UNC path to the source. Commented Jan 7, 2016 at 14:11
  • Within the script, add "start-transcript c:\temp\xyz.log" at the top, and "stop-transcript" at the bottom. After script has run, what's in the transcript? Commented Jan 7, 2016 at 14:13
  • I've tried the "Run with highest privileges" without success. We are using drive letters (d$) and UNC Paths. Both same result. This is the output using Task Scheduler or directly running: ********************** Windows PowerShell Transcript Start Start time: 20160107155212 Username : PFS\svc_abacus_copy Machine : PFSVSV011 (Microsoft Windows NT 6.1.7601 Service Pack 1) ********************** Transcript started, output file is C:\temp\xyz.log ********************** Windows PowerShell Transcript End End time: 20160107155212 ********************** Commented Jan 7, 2016 at 14:55
  • Simplify this issue first. Change the source and destination to something both local and see if the same thing happens. Commented Jan 7, 2016 at 15:44
  • I have allready tried that. Same result if i copy from one folder to a sub folder on the same system. Commented Jan 7, 2016 at 15:50

1 Answer 1

0

There's a check box to not save password. Network resources including shares won't work if you don't have it save the password.

Also ensure your using -executionpolicy bypass.

Application: powershell.exe Parameters: -f script.ps1 -executionpolicy bypass

2
  • Thanks Nick Young! The Executionpolicy resolved the issue! Commented Jan 11, 2016 at 8:34
  • Great. If you find my answer complete mark it as such. If someone else's was more helpful mark theirs. Also don't forget to up vote anything you found helped troubleshooting so others can find the answers they need. Commented Jan 11, 2016 at 11:56

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.