JoelBlogs - Joel Jeffery's Microsoft 365 Blog

Microsoft 365, SharePoint, Teams and Office 365 Architecture, Development, Administration and Training

  • Home
    • Sitemap
  • Articles
    • #SPThingADay
    • SharePoint Online
      • SharePoint Online – Drag and Drop and Large File Uploads
    • SharePoint 2016
    • SharePoint 2013
      • Content Database Changes to the AllUserData Table
    • SharePoint 2010
      • Administration
        • Disable CRL Checking
        • Excel 2010 & PowerPivot
        • Limits & Thresholds
        • PeoplePicker AD Errors
        • Recycle Bin Behaviour
        • Renaming a Server
        • Service Pack 1
        • Unattended Installs
        • Uninstall All SharePoint 2010 Solutions via PowerShell
        • User Alert Management
        • Virtualised SharePoint
        • Visio Stencils for Administrators
      • Development
        • Audience Membership Workflow Activity
        • Base Types, Lists & Content Types
        • BCS & Offline Sync
        • Debugger Skipping Lines
        • Development Laptop Spec
        • Enabling JavaScript IntelliSense
        • Event Receivers & Deployment Jobs
        • FavIcons & SPUrl
        • Google Maps Sandbox Web Part
        • Group By Content Type for List Views
        • Locale Stapler / Master or Default Locale
        • Removing Default Editor Parts
        • Sandbox Embedding Resources
        • Solution Sandbox Introduction
        • SPPersistedObject
        • Restoring Deleted SPSites in SP1
        • SPWebConfigModification 1
        • SPWebConfigModification 2
        • STSADM copyappbincontent vs. Install-SPApplicationContent
        • Workflows for Beginners
        • Workflow InitiationData Seralizer
    • SharePoint 2007
      • Alternate Access Mappings
      • Excel Services
      • Excel Services UDFs & Excel Client 2007
      • Experiences from the Field
      • InfoPath & Forms Server
      • Kerberos & SSRS
      • Records Management
      • Web Application Service
      • WSS vs MOSS
  • Training
    • SharePoint Admin Links
  • Downloads
    • Summary Slides for PowerPoint
    • CodePlex Projects
      • Audience Membership Workflow Activity
      • Google Maps Sandbox Web Part
      • Group By Content Type in List Views
      • Locale Stapler / Master or Default Locale
      • SharePoint Outlook Connector
  • Hire Me!
    • MCP Transcript
    • Résumé/CV

Automatically Generating Thesaurus Files from Taxonomy for SharePoint Search

July 4, 2012 by Joel Jeffery

A while ago, a student of mine asked if it was possible to use the taxonomic alternative labels from the Managed Metadata Service as thesaurus items in SharePoint Server Search.

There’s no built-in way to do this, but it is possible to generate the required Xml with a little PowerShell.

The Concept

The Term Store contains Term Group, which content Term Sets, which in turn contain nested Terms. Each Term can have (optional) synonyms called Labels.

If we find all the Terms with Labels, we can write them out in the correct format as a chunk of Xml, and pipe it into a thesaurus file.

Thesaurus files for SharePoint Server Search are kept under the file path:

%ProgramFiles%\Microsoft Office Servers\14.0\Data\Office Server\Applications\GUID-query-0\Config

A sample thesaurus file is shown below:

<XML ID="Microsoft Search Thesaurus">
    <thesaurus xmlns="x-schema:tsSchema.xml">
        <diacritics_sensitive>0</diacritics_sensitive>
        <expansion>
            <sub>Internet Explorer</sub>
            <sub>IE</sub>
            <sub>IE8</sub>
        </expansion>
        <replacement>
            <pat>NT5</pat>
            <pat>W2K</pat>
            <sub>Windows 2000</sub>
        </replacement>
    </thesaurus>
</XML>

You can see the rationale for how this file works on and how to manage thesaurus files at TechNet.

The Script

The script below shows the principle. It iterates over the Terms in each Term Store and finds their Labels. Where the Label is not the same as the name of the Term itself, it represents a synonym and we add it to the Xml.

function Extract-SPThesaurusFromTermLabels
{
  param([string] $webUrl);
  $ts = Get-SPTaxonomySession -Site $webUrl;
  Write-Output "<XML ID='Microsoft Search Thesaurus'>"; 
  Write-Output "<thesaurus xmlns='x-schema:tsSchema.xml'>"; 
  $ts.TermStores | 
  % { $_.Groups | 
    % { $_.TermSets | 
      % { $_.Terms | 
        % { $_.Labels | 
          ? {$_.Term.Name -ne $_.Value} |
          % { 
            Write-Output ("<expansion><sub>" + $_.Term.Name + 
              "</sub><sub>" + $_.Value + "</sub><expansion>");
          } 
        } 
      } 
    } 
  }; 
  Write-Output "</thesaurus>"; 
  Write-Output "</XML>";
}

You can then pipe the output of this command to an Xml file, and optionally use this in the place of your existing Thesaurus file with something like this:

Extract-SPThesaurusFromTermLabels http://sharepoint > tsLANG.xml

As always, please back up your original Thesaurus files and check the output of this before you use it! Smile

Filed Under: SharePoint 2010 Tagged With: PowerShell, Search, SharePoint, SharePoint 2010, SharePoint Administration, SharePoint Administrator

Certificate Revocation List Check and SharePoint 2010 without an Internet Connection

September 20, 2011 by Joel Jeffery

UPDATED: Fix Slow SharePoint 2010 System Performance with the CRL Check

Sometimes you need to install SharePoint 2010 in an environment where the servers do not have an effective Internet connection. This posses a big problem.

Most Microsoft assemblies and DLLs are digitally signed. Each time signed assemblies are loaded, default system behaviour is to check with the owner of the root certificate that the cert with which the assembly was signed is still valid. In the case of Microsoft assemblies, this means “phoning home” to read the Certificate Revocation List at crl.microsoft.com .

Whilst this is all very well and good if you have an Internet connection, sometimes you don’t have this luxury. Many web servers, for instance, don’t have outbound Internet accessibility. The CRL check will attempt to connect to Microsoft’s servers and then timeout, usually within 30-60 seconds.

With SharePoint, you’ll get a lot of delays in this scenario. One way to check if your server is affected by this condition is to open up a SharePoint Management Console PowerShell window and run the “STSADM -help” command. If it takes 30 seconds or more to display the usage instructions, then you will be experiencing really slow server performance.

See how long STSADM takes to load

Disabling the CRL Check

There are three workarounds to this problem, in reverse order of preference:

  1. Give your servers an outbound Internet connection
  2. Edit the hosts file at “%SYSTEMROOT%\\System32\\drivers\\etc\\hosts” to fool the CRL check into thinking your local machine is crl.microsoft.com by pointing it at 127.0.0.1 (localhost):
    Editing the HOSTS file in Notepad
  3. Edit the registry to disable CRL checking by setting the State DWORD to 146944 decimal (SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\WinTrust\\Trust Providers\\Software Publishing for both HKEY_USERS\\.DEFAULT and HKEY_CURRENT_USER) with the following lines of PowerShell:
    #the following statement goes on one line
    set-ItemProperty -path "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion
    \\WinTrust\\Trust Providers\\Software Publishing" 
     -name State -value 146944
    
    #the following statement goes on one line also
    set-ItemProperty -path "REGISTRY::\\HKEY_USERS\\.Default\\Software\\Microsoft
    \\Windows\\CurrentVersion\\WinTrust\\Trust Providers\\Software Publishing" 
     -name State -value 146944
    
    #UPDATED: and the following statement goes on one line too
    get-ChildItem REGISTRY::HKEY_USERS | foreach-object {set-ItemProperty -ErrorAction 
    silentlycontinue -path ($_.Name + "\\Software\\Microsoft
    \\Windows\\CurrentVersion\\WinTrust\\Trust Providers\\Software Publishing") 
    -name State -value 146944}
  4. UPDATED: Edit the machine.configs and disable it there. There’s a nice piece of code from the most excellent AutoSPInstaller (autospinstaller.codeplex.com) that does this:
  5. Write-Host -ForegroundColor White " - Disabling Certificate Revocation List (CRL) check..."
    ForEach($bitsize in ("","64")) 
    {            
      $xml = [xml](Get-Content $env:windir\\Microsoft.NET\\Framework$bitsize\\v2.0.50727\\CONFIG\\Machine.config)
      If (!$xml.DocumentElement.SelectSingleNode("runtime")) { 
        $runtime = $xml.CreateElement("runtime")
        $xml.DocumentElement.AppendChild($runtime) | Out-Null
      }
      If (!$xml.DocumentElement.SelectSingleNode("runtime/generatePublisherEvidence")) {
        $gpe = $xml.CreateElement("generatePublisherEvidence")
        $xml.DocumentElement.SelectSingleNode("runtime").AppendChild($gpe)  | Out-Null
      }
      $xml.DocumentElement.SelectSingleNode("runtime/generatePublisherEvidence").SetAttribute("enabled","false")  | Out-Null
      $xml.Save("$env:windir\\Microsoft.NET\\Framework$bitsize\\v2.0.50727\\CONFIG\\Machine.config")
    }

Method 3 is the preferred method, and should have things loading about as quickly as possible. UPDATED: Method 4 is more likely to work, but you’re editing some pretty important files there, so be careful!

UPDATED: You can download a script that combines these methods here: http://static.joelblogs.co.uk/uploads/2012/03/Disable-CRLCheckv2.zip.

As usual, no warranty etc etc, use at your own discretion!

Filed Under: SharePoint 2010 Tagged With: SharePoint, SharePoint 2010 Training, SharePoint Administration, SharePoint Administrator

Next Page »

Joel is a full-stack cloud architect who codes. He is a Microsoft Certified SharePoint Online, SharePoint Server and Azure specialist and Microsoft Certified Trainer.
He has over 20 years' experience with SharePoint and the Microsoft .NET Framework.
He's also co-founder of Microsoft Gold Partner JFDI Consulting Ltd. Read More…

Recent Posts

  • Microsoft Flow Tip #1 – Word Templates and Hiding Empty Repeating Sections
  • SharePoint PowerShell Tip #1 – Select-Object and FieldValues
  • Popular Misconceptions – Microsoft Teams relationship with SharePoint
  • Course: Microsoft 365 Certified Teamwork Administrator
  • Audience Targeted Searches in Modern SharePoint Online
MCT 2020-2021
Microsoft Teamwork Administrator Associate
Joel's Acclaim Profile
Joel's Microsoft Profile

Tags

Administration Architecture Certification Cloud Development Information Architecture intranets MCP Microsoft Microsoft Architecture Microsoft Azure migration Mobile Development MOSS MOSS 2007 office365 Office 365 Office 365 PowerShell SaaS SharePoint SharePoint 2010 SharePoint 2010 Training SharePoint 2013 SharePoint Administration SharePoint Administrator SharePoint Architecture SharePoint Designer 2010 SharePoint Developer SharePoint Development SharePoint Online sharepointonline SharePoint Search SharePoint Training SharePoint Videos Silverlight SOA Solution Sandbox SPThingADay TechEd 2007 Training Videos Visual Studio 2010 Windows Phone 7 WSS

Copyright © 2022 Joel Jeffery, SharePoint Architect