I have Windows Server 2012 with SharePoint 2013 setup.
I created a PShell script and saved it to a ps1 which backs up the Farm:
Add-PsSnapin Microsoft.SharePoint.Powershell
Backup-SPFarm -Directory d:\backup\Farm -BackupMethod full
If I run this from PShell, i.e point to the location of the ps1 file and open it, it works perfectly.
However it does not run from Task Scheduler which is driving me nuts. Sched Task is:
- Run when logged on or not
- Run highest priveliges
- Program/Scipt: -- C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
- Argument: location of PS1
Doesn't run on schedule or if run now (is allowed to run now in settings).
User account has access to DB and is same user I'm using to login as so it's fine when running from PShell directly. Also it is a local admin.
From Sched Task it just goes Running and then Ready but no backup created. As a test I added in a 2nd part to the script to send an email when it runs the task. The email is sent without a problem.
No errors, nothing in logs, just zilch.
Any ideas?