Run SharePoint Timer jobs from PowerShell
We are currently moving from using stsadm to using PowerShell for our SharePoint install scripts.
We have not been able to find an equivilent to this:
stsadm -o -execadmsvcjobs
We have tried putting in a pause, but it vari开发者_如何学运维es how long the pause needs to be.
Is there an equivilent command in PowerShell, or could we run this command from PowerShell?
Have a look at the Start-SPAdminJob
cmdlet here
According to this article, it is the equivalent of execadmsvcjobs.
We ended up using this solution from Sohel's Blog
http://ranaictiu-technicalblog.blogspot.com/2010/05/sharepoint-2010-deployment-powershell.html
Try using something like this:
$wa = Get-SPWebApplication $url
Get-SPTimerJob | ?{$_.Name -match "VariationsCreateHierarchies"} | ?{$_.Parent -eq $wa} | Start-SPTimerJob
This snippet runs the Create Variations Hierarchies job for the the web application at $url
精彩评论