Created
June 2, 2016 01:43
-
-
Save daveselias/68a2bc02e78a6a422d2408c5ee3b6e29 to your computer and use it in GitHub Desktop.
start all LANDesk 9.6sp2 scheduled tasks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$core = "MyCoreServerName" | |
$ldmS = New-WebServiceProxy -uri http://$core/MBSDKService/MsgSDK.asmx?WSDL -UseDefaultCredential | |
$TASKS = $LDMS.ListSWDTasks() | |
$NoPush = $TASKS.ScheduledTasks | Where-Object {($_.DeliveryMethodName -notlike '*push*') -and ($_.Status -like "Available For Download")} | Sort-Object TaskID | |
$T = $NoPush.count | |
$N=0 | |
ForEach($Task in $NoPush){ | |
$N++ | |
$Started = $LDMS.StartTaskNow("$($Task.TaskID)","all") | |
IF($Started -eq $true){ | |
Write-Host "Successfully started Task ($N of $T) $($task.TaskName)" | |
}ELSEIF($Started -eq $false){ | |
Write-Warning -Message "Failed to start Task ($N of $T) $($task.TaskName)" | |
} | |
IF($N -like '*0'){ | |
Write-Host "----Waiting 5 minutes for the previous 10 tasks to complete----" -ForegroundColor Cyan | |
Start-Sleep -Seconds 300 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment