Indexing Large Files in SharePoint 2010

Like it’s predecessor, SharePoint 2010 also doesn’t index files larger than 16 MB by default. This is because the search service application property ‘MaxDownloadSize’ is set to 16 MB by default. We can change this by running the following PowerShell commands and restarting search service.

$dSize = Get-SPEnterpriseSearchServiceApplication;
$dSize.SetProperty("MaxDownloadSize", 32);

The above commands will increase the max size of files that SharePoint can index to 32 MB from 16 MB (default).

To restart search service, run the following command on the indexing server.

Restart-Service osearch14;

Restoring Deleted Site Collections

One of the best features that SP1 brought to SharePoint administration is the ability to recover deleted site collections. I’ve had many incidents where this came handy.

You have to use PowerShell or Object Model recover a deleted site collection. Here is how you can do it using PowerShell.

In SharePoint 2010 Management Shell, provide the following command.

Restore-SPDeletedSite -Identity <relative URL or GUID>

More details on this command can be found in this Technet article. The deleted site collections are stored as SPDeletedSite objects. If you do not remember the URL or GUID of the deleted site collection, you can find it using the command,



SPUpdatedConcurrencyException While Installing SharePoint 2010 Service Pack 1

After installing SharePoint 2010 Service Pack 1 for SharePoint Server, the SharePoint Products and Technologies Configuration Wizard (either from GUI or using PowerShell) may fail throwing the following exception.

An exception of type Microsoft.SharePoint.Administration.SPUpdatedConcurrencyException was thrown. Additional exception information: An update conflict has occurred, and you must re-try this action. The object SPUpgradeSession Name=Upgrade -20110924-194525-15 was updated by DOMAIN\ACCOUNT, in the PSCONFIG (7240) process, on machine SERVER. View the tracing log for more information about the conflict.

Total number of configuration settings run: 3

Total number of successful configuration settings: 2

Total number of unsuccessful configuration settings: 1

Successfully stopped the configuration of SharePoint Products.

Configuration of SharePoint Products failed. Configuration must be performed before you use SharePoint Products. For further details, see the diagnostic log located at [LOCATION OF LOG] and the application event log.

This KB article describes the cause and and solution for this issue. The suggested solution is to clear Windows SharePoint Services configuration cache. Unfortunately, this may not work in most of the cases. If it doesn’t work, there is another workaround. This is by setting the ‘command-line-upgrade-running’ configuration property to ‘No’ and running Configuration Wizard again. Entire steps are given below.

  1. Open command prompt as administrator.
  2. Type in the command: stsadm -o setproperty -pn command-line-upgrade-running -pv No
  3. Restart IIS and SP Timer
  4. Run configuration wizard: psconfig -cmd upgrade -inplace b2b -wait –force

The entire steps has to be done in all the web and app servers.

Cannot Delete Site Columns from Document Library or Content Type

Recently I ran into an issue where one of the SharePoint users added an existing site column called “Active” into one of the document libraries and was not able to remove it. This is a strange behavior from SharePoint and is because some “AllowDeletion” field property is set to true by default. Anyway, I was able to delete the filed using the following PowerShell script.

$web = Get-SPWeb https://siteurl/
$list = $web.Lists["Shared Documents"]
$field = $list.Fields["Active"]
$field.AllowDeletion = “true”
$field.Sealed = “false”

In this case, the column was added only to the Document Library; not to the site content type. If these types of columns were added to site content types, you could use the following script.

$web = Get-SPWeb http://siteurl/
$ct = $web.ContentTypes["Document"]
$spFieldLink = New-Object Microsoft.SharePoint.SPFieldLink($web.Fields["Active"])

Thanks to Brendan Well’s blog which saved me a lot of time.

Scheduling SharePoint PowerShell Scripts in Windows Server 2008 R2

In order to schedule a SharePoint PowerShell script to be run on specific time in Windows Server 2008 R2, perform the following procedures.

  1. Save your PowerShell script into some folder location with .ps1 extension.
  2. Create a new task in Windows task scheduler. Specify the user account the PowerShell script to use when running.
  3. In Actions, add  new action of type “Start Program”. In the Program/Script section, provide full path of “PowerShell.exe” file. That is, “C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe”.
  4. In the Add Arguments field, it needs two arguments. One is the path to SharePoint Administration Console file and the other is the path to your PowerShell script file. This can be provided as follows:
    • -PSConsoleFile "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration\psconsole.psc1" -Command " & ‘<folder path>\<your script file>.ps1’ "
  5. The “Start in” optional filed has to be provided as the folder location where your script resides if your script uses current folder for getting resources files or saving log files.
  6. Set other necessary options such as Triggers, Conditions etc. and save the task.