Schedule Task fails to run

Windows server 2012R2, running a schedule task to call a PowerShell script. Script runs fine if manually started. Task runs fine if in the GENERAL tab I select "Run only when user is logged on".
Does NOT run if I select "Run whether user is logged on or not"
Account has permissions to script, location, destination. Passwords are correct. Account is a domain admin account
ACTIONS:
Program\Script: %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe
Add arguments (options): C:\Scripts\DailyNAS.ps1
HISTORY:
100: Task Started (1)
200 Action Started (1)
110 Task triggered by user Info
210 Action Completed (2)
102 Task Completed (2)

All History items happen within 1 second, the script is to run a 110GB Backup from file server to NAS. No folder is created, and no 110GB backup happens in less than 1 sec.

If anyone can help I'll email you a cookie :-)
TheHighlandersAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

noxchoGlobal Support CoordinatorCommented:
If you create a scheduled task which starts notepad under specific user - will it run?
TheHighlandersAuthor Commented:
Just tried. yes it does, notepad launched first time.
Thanks

Also "Run with highest privilege" is TRUE
Run as Server 2008 R2: TRUE
noxchoGlobal Support CoordinatorCommented:
Now, if you replace the start of the notepad with your script - will it run? I guess the task for script is running under local admin, right?
SD-WAN: Making It Work for You

As bandwidth requirements and Internet costs grow, businesses naturally want to manage budgets by reducing reliance on their most expensive connection types. Learn more about how to make SD-WAN work for your business in our on-demand webinar!

TheHighlandersAuthor Commented:
Just tried, didn't run, have tried to create a brand new task in case I messed something up, still not working.
Have tried Local Admin and Domain Admin.
Can copy & paste script startup params to "run" and it kicks off fine.
Have tried
powershell -file "C:\Scripts\DailyNAS.ps1"
Also the param in the O.P.
both work fine when ran manually, or with "Run only when user is logged on" radio button ticked.

Have tried the "Start in (optional)" as I have seen this suggested in places with C:\Scripts but this also fails.
footechCommented:
Some resources aren't available unless a user is logged in.  We'd really have to see the script to determine if that's the case.
TheHighlandersAuthor Commented:
It's just a robocopy script with multiple lines.

robocopy "\\SAS-DC\Data\Correspondance - client" "y:\Daily\Correspondance - client" /s /e /mir /R:1 /W:1

Y: is a mapped drive to the NAS
The NAS is a non domain joined NAS, Buffalo terastation.
NVITEnd-user supportCommented:
Are you using mapped drives in the script? If so, change them to UNC. e.g. z:\ becomes \\server\share.
Or, add  code inside the script to map the drives.

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
TheHighlandersAuthor Commented:
update: have tried the script with:

robocopy "\\SAS-DC\Data\Correspondance - client" "\\192.168.1.6\Daily\Correspondance - client" /s /e /mir /R:1 /W:1

In case it was having problems with hte mapped drive letter when not logged on. Still fails :-(
TheHighlandersAuthor Commented:
Thanks very much, it was add code in the script to remove the currently mapped drive, and remap with credentials and workgroup name and drive letter.
you sir\madam are a hero!!!!

Used these lines:

net use y: /delete
net use y: \\192.168.1.6\Daily <PASSWORD> /USER:workgroup\admin /persistent:yes

robocopy "\\SAS-DC\Data\Correspondance - client" "y:\Daily\Correspondance - client" /s /e /mir /R:1 /W:1
etc...
etc...
etc...
NVITEnd-user supportCommented:
I'm glad it worked out, TheHighlanders. Have a good one!
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.