0

I have SP2010 in WIN2008R2, i have script(datemodifier.ps1) to update the diff of 2 dates in SP list daily, When I run the script manually its updating the list, but when i schedule it with a task on task scheduler its not working.

Steps I performed:

Step-1

General: Runs whether user logs in or not Triggers: Daily Action: Start a programm, Programm/Script: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe, Add arguments(optional): -ExecutionPolicy Unrestricted -Filepath

Not worked.

Step2:

Tried Programm/Script: PowerShell.exe, Add arguments(optional): filepath.ps1 not working

I need a solution ASAP. Thankful in advance.

  • More preferred way is to use SharePoint timer Job or Site workflow to achieve your requirement. PS script is not the best solution. – Raf Nov 22 '19 at 6:56
1

Are you loading the SharePoint PowerShell modules in your script? If not, try adding the following to the start of your script:

Add-PSSnapin Microsoft.SharePoint.Powershell

When you start the SharePoint Management shell this is automatically loaded. This could explain the different behaviours.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.