add-pssnapin microsoft.sharepoint.powershell $spserver = get-spserver | ?{$_.role -eq "Application"} foreach ($server in $spserver) { $name = [string]::concat("\\", $server.name) write-host "Performing IIS Reset on Server:"$server.name iisreset $server.Name write-host "Stopping SPTimerV4 on Server:"$server.name $stat = sc.exe $name stop sptimerv4 $stat = sc.exe $name query sptimerv4 while ($stat -match "STOP_PENDING") { write-host "Stopping" $stat = sc.exe $name query sptimerv4 start-sleep 4 } write-host "Starting SPTimerV4 on Server:"$server.name $stat = sc.exe $name start sptimerv4 $stat = sc.exe $name query sptimerv4 while (-not $stat -match "RUNNING") { write-host "Starting" $stat = sc.exe $name query sptimerv4 start-sleep 4 } write-host "SPTimerV4 started on Server:"$server.name}