Wednesday, 8 February 2017

Troubleshooting PowerShell Based Scheduled Tasks

If you to schedule any of task using Task scheduler in windows system, we need to make sure all configuration has been setup properly.
In case we are running backup task for SharePoint content Database with PowerShell script, we need to make sure script should be correct and passed all parameter successfully. Also we should have appropriate permission to run backup on SharePoint server. We need to see the path also which you have assigned is exist or not.
Once all done above, create a simple task in task scheduler and attach the .PS1 file and save the same.
Now we need to run this and later we have received an error called Backup –SPFarm: A positional parameter cannot be found that accepts argument. See below screen shot:

  • After troubleshooting a lot I came to know we have not passed PowerShell add arguments in task scheduler.
  • To fix this above issue: Just open task schedule and open the properties of task which is configured in task scheduler.
  • Selected Action tab from task properties and edit the same task and added powershell argument in the starting file of selected path:

Once all done save the same and re run again this time we got expected result without any issue.

No comments:

Post a Comment