Chad's Eclectic Tips and Tricks

Tips some days, not everyday, mostly Windows & SharePoint from Chad Schultz - Premier Field Engineer

June, 2010

  • Tip 35: Run Every Timer Job Now!

    This tip is for SharePoint Foundation 2010, SharePoint Server 2010 and Search Server 2010 Express.

    Are you sick of waiting for a timer job to run? Don't want to use the "Run Now" button in the timer job definitions properties page in Central Administration->Monitoring->Review Job Definitions? Or do not know which exact timer job needs to run for a specific function?

    Use the commands below in the SharePoint 2010 Management Console to run every timer job in the farm that is not disabled (FYI: disabled jobs throw an exception if you try to run them, but no harm is done.).

    $timers=Get-SPTimerJob|? {$_.isDisabled -eq $false}

    foreach ($timer in $timers) {$timer.RunNow()}

    A good use of these commands is in development work, a lot of time can be wasted waiting for timer jobs to perform actions on data changed while developing and sometimes it's easier to just run all of the timer jobs if the specific job is unknown. That said, I do not recommend running this command on a production farm as you may see at the very least a performance hit while all of the jobs run and worse, errors while running the jobs.

  • Tip 34: Adding a SharePoint 2010 Search Suggestion

    This tip is for SharePoint Server 2010, Search Server 2010 and Search Server 2010 Express.

    SharePoint Server 2010 and Search Server 2010 Express include a new feature for search called Search Suggestions. Search suggestions are listing below the search box that suggests search terms while you are typing your search query. They have been around for a few years in sites like www.bing.com and are now integrated into SharePoint 2010. Below is a screenshot of a SharePoint Enterprise Search Center site with a suggestion.

    SearchSuggestion

    Suggestions are automatically built based on what search results are actually clicked on. It takes 6 clicks within a year for SharePoint to add a suggestion; if an administrator needs to add a suggestion manually this can be done using the SharePoint 2010 Management Shell (PowerShell). The commands below will add the suggestion, "Suggestion" to the first Search Service Application and run the Prepare Query Suggestions timer job now. The Prepare Query Suggestions timer job is set to run daily between 1AM and 11PM local server time so this will speed up the time before the suggestion will appear in the search query suggestions list.

    $ssa=Get-SPEnterpriseSearchServiceApplication

    New-SPEnterpriseSearchLanguageResourcePhrase -SearchApplication $ssa -Language en-US -Type QuerySuggestionAlwaysSuggest -Name "Suggestion"

    $timer=Get-SPTimerJob|? {$_.Name -eq "Prepare Query Suggestions"}

    $timer.RunNow()

    After the above commands have been run and the timer job has been run, the suggestion and other suggestions in a Search Service Application can be listed by running the following command from the SharePoint 2010 Management Console.

    Get-SPEnterpriseSearchQuerySuggestionCandidates -SearchApp $ssa

    To remove the suggestion, run the following command.

    Remove-SPEnterpriseSearchLanguageResourcePhrase -SearchApplication $ssa -Language En-Us -Type QuerySuggestionAlwaysSuggest -Identity "Suggestion"