Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Thursday, June 23, 2016 11:10 PM
Hi,
I have an requirement, with Two PowerShell Scripts , which should run one after other immediately. So i have added both powershell scripts in one task in task scheduler.
But i can see, it is running only the first Power Shell Script. I want to confirm, if we can run 2 powershell scripts(one after one immediately) in one task.
Reason, why i am scheduling the 2 scripts in one task is, some times my first script may take extra time to run(depending upon the data to move).
Any suggestions please.
Thanks in Advance.
Badri
All replies (4)
Friday, June 24, 2016 8:21 AM âś…Answered
Hi Badrinarayana,
You could consider to create two tasks to scheduler two PowerShell Scripts. And run the two tasks one by one.
More reference:
SharePoint Tasks with PowerShell.
http://blog.falchionconsulting.com/index.php/2013/06/parallel-sharepoint-tasks-with-powershell-2/
Running a SharePoint PowerShell script from Task Scheduler.
http://get-spscripts.com/2011/01/running-sharepoint-powershell-script.html
Best regards,
Sara Fan
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected].
Friday, June 24, 2016 3:34 AM | 1 vote
Hi Badri
This should work provided you have configured both scripts in actions pane and configured them properly. Also second script will be invoked only when program opened by first script is closed. So first script should provide a proper exit.
Thanks
Mohit
Friday, June 24, 2016 4:19 AM | 1 vote
Alternatively, you can use dot source notation to call second script from first one itself.
Thanks
Mohit
Friday, June 24, 2016 4:34 AM | 1 vote
Another option is to create a batch file and invoke power shell one by one. Use the batch file in the task scheduler.