I needed to enable / configure BLOB caching on multiple sharepoint sites.
This is done by editing the web.config of each SharePoint site, on each SharePoint server.
I wrote this down and dirty script so I would not need to edit all the web.config’s by hand (I had about 20 web.configs to touch)
Note that since its just editing the web.config, we don’t need to run this in a SharePoint shell – I ran it from an ordinary PowerShell command prompt on my workstation.
Echo "Run this script under an admin account with rights to the servers being hit"
$dir = "\Serverc$inetpubwwwrootwssVirtualDirectories"
$currentDate = (get-date).tostring("mm_dd_yyyy-hh_mm_ss")
# loop through each subdirectory to find each sharepoint site.
foreach ($subdir in dir $dir)
# Here In my case, all my SharePoint sites had mydomain.com as part of the folder names,
# So the contains statement was an easy way to only touch the web.config's of actual SharePoint sites
# while leaving alone central admin and other non-SharePoint websites IIS had.
$path = $dir + "" + $subdir.name + "Web.config"
$backup = $path + "_$currentDate.bak"
$xml = New-Object XML
$element = $xml.configuration.SharePoint.BlobCache
$element.location = "X:BlobCache14"
$element.enabled = "true"
$element.maxSize = "5"
Over on my old Blog, Basementjack.com, Remco de Groot commented that this isn’t the best way to change a web.config in SharePoint and he’s absolutely right!
He sent over a script from
The article above does a great job of explaining the new script and is a must read. In summary, it uses SharePoint to make the change, and this is a huge help down the line if you ever need to add or replace a SharePoint server in the farm.
I’ll leave the original post’s code above for search engines and as an example of using XML with PowerShell. That said, if you’re here to enable Blob Cache, then definately head on over to the article above
If search results from SharePoint (not Fast) search are not showing the right title, and instead are showing a few words from the content of the document, theres a registry setting you can set to fix that.
The registry setting will be found on any machine running sharepoint search (Central admin-> Manage servers in this farm will show you which boxes have this role)
These powershell commands will show what the value is currently (or an error if its not found – a good sign that you’re on the wrong machine!)
$RegKey ="SOFTWAREMicrosoftOffice Server14.0SearchGlobalGathering Manager"
$key = "EnableLastModifiedOverride"
Get-ItemProperty -path. -name $key | Select $key
$key = "EnableOptimisticTitleOverride"
Get-ItemProperty -path. -name $key | Select $key
(you can see the registry entries in the code, you can edit these manually if you’d like)
This script changes the values to 0, fixing the office 2007 issue in SP2010 search:
$RegKey ="HKLM:SOFTWAREMicrosoftOffice Server14.0SearchGlobalGathering Manager"
set-ItemProperty -path $RegKey -name EnableLastModifiedOverride -value 0
set-ItemProperty -path $RegKey -name EnableOptimisticTitleOverride -value 0
After you’re done with the above, restart the Sharepoint search service and do a full crawl – it is not necessary to reset the index.
I recently ran into a few issues installing SharePoint 2013 that can easily be avoided by installing in a given order.
Firstly for the quick install, this seemed problem free:
1) Build a new windows 2008R2 SP1 Standard edition VM
(I gave mine 3GB of ram)
1a) I joined it to a domain (I did not build the VM as a domain controller)
2) be sure you have an internet connection
3) install sharepoint 2013 preview, choose the standdalone version. (the one that will install the free version of SQL2008 R2
This seemed to work fine.
The trouble came when I tried to install it with the latest version of SQL
Here’s what I did:
(Warning: this fails!)
1) Build a new windows 2008 R2 SP1 standard edition VM
2) Install the RTM version of SQL2012 – it needed .net 4 and IIS
(I think this is where things went wrong, SQL2012 configued IIS with .net 4, not 4.5)
3) tried to run sharepoint install – it failed on the pre-reqs – it seems in my case it could not determine if IIS was setup with .net properly. I even tried the old aspnet_regiis -i command to force it but still the pre-req installer would stop at that point.
I must admin, I was in a hurry to see the new SharePoint so I didn’t take additional troubleshooting steps (I could have downloaded the rest of the prereq’s manually and tried the SharePoint install, but I did not)
Instead I figured I’d try a different approach – first I tried the install I listed at the top of this article – that worked like a champ, but I wanted the SQL2012 based install.
Next I did this:
1) new VM with Windows Server 2008 R2 SP1
2) Run the pre-req installer from the sharepoint 2013 install iso.
(this configured IIS, and ASP.net 4.5)
3) Do NOT run the SharePoint installer
4) Install SQL 2012 – since IIS and ASP.net 4.5 are already installed it should leave them alone.
5) Come back and do the SharePoint install
It’s installing now – I’ll post the results when it’s done.