Run a Powershell Script with Task Scheduler

Powershell gives you many options to administrate your farm, but it also can help you to get certain jobs done regularly. In one of my customer projects it was necessary to copy a certain document from library A to library B each month on the same day.

We created therefore a small powershell script which does the job including logging. Now we added it to the windows task scheduler and configured it for our needs. In the action tab we added an action which starts a program. We typed in there powershell and added the powershell script as parameter.

Parameter: -file “C:\Users\pohnke\Downloads\CopyFileToAnotherLibrary.ps1”

psTask1

That’s all. The solution is simple and it took only a few minutes to get a working solution.

Another possibility would have been to develop a timer job in SharePoint with all following processes: Development, Testing, Install on Staging, Testing, Install on Production, Testing, Documentation, etc. which would take hours.

Great to have Powershell.

The article or information provided here represents completely my own personal view & thought. It is recommended to test the content or scripts of the site in the lab, before making use in the production environment & use it completely at your own risk. The articles, scripts, suggestions or tricks published on the site are provided AS-IS with no warranties or guarantees and confers no rights.

Karsten Pohnke About Karsten Pohnke
He is Consultant for SharePoint Solutions for collaboration, communication and business processes. He provides his customers applications based on standard features as well as development or combining the power of several microsoft tools like Dynamics CRM. In his free time he tries to collect tipps and worthy experience in this blog.

Submit comment

Allowed HTML tags: <a href="http://google.com">google</a> <strong>bold</strong> <em>emphasized</em> <code>code</code> <blockquote>
quote
</blockquote>

Please fill in the captcha: * Time limit is exhausted. Please reload CAPTCHA.