Move your SharePoint 2010 logs off of your C drive

There are two sets of logs you want to move, the diagnostic logs and the usage logs. An important note is that every machine in the farm must have the same paths for this to work. If one doesn’t have a D drive or something SharePoint will freak out.

Here are the steps:

Diagnostic logs:

Central Admin > Monitoring > Configure Diagnostic Logging (/_admin/metrics.aspx). The setting is the “Trace Log” path at the bottom. I strongly recommend only changing the drive letter. Leave the path alone. It’ll make it easier for you to find things later on. You can also use PowerShell to change this. The cmdlet is Set-SPDiagnosticConfig and the parameter is –LogLocation.

 

With PowerShell:

Set-SPDiagnosticConfig -LogLocation "E:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS”

Usage logs:

Central Admin > Monitoring > Configure web analytics and health data collection (/_admin/LogUsage.aspx). The setting is the “Log file location” setting. Set it to the same path you did the Trace Log above. Again, don’t get fancy and put it at something like “D:\SharePoint\Stuff\Things\LogsAreHiddenHere” The PowerShell cmdlet to alter this is Set-SPUsageService and the parameter is –UsageLogLocation.

 

With PowerShell:

Set-SPUsageService -UsageLogLocation "E:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS\"

How it looks:

 

Your disk savings won’t be crazy big, but every little bit counts. By way of comparison the Logs folder on this web server is taking up 3 GB

The Usage logs get removed once they’re parsed and the Trace logs in that directory go back to 12/19/2011. Your server will certainly have more traffic than mine does, so your logs will probably be larger.

Your client does not support opening this list with Windows Explorer

Just a quick solution in case you ever get the following message when trying to open a SharePoint Document Library in explorer view from Windows Server 2008

Your client does not support opening this list with Windows Explorer.

This is due to the fact that Explorer view uses the WebDav protocol to connect to SharePoint from the client. As Windows Server is not designed to be a client, the WebDav client is not installed or enabled by default.

In order to enable the WebDav client on a server,simply enable the Desktop Experience feature.

Adobe iFilter for SharePoint 2010

Adobe PDF iFilter lets you index Adobe PDF documents in Microsoft SharePoint Server 2010 and Microsoft SharePoint Foundation 2010.

To install and configure Adobe PDF iFilter 9 in SharePoint Server 2010 and SharePoint Foundation 2010, follow these steps:

  1. Install Windows Server and SharePoint. This step includes the following tasks:
    • Install Windows Server 2008.
    • Install the SharePoint prerequisites. To do this, run the Microsoft SharePoint Products Preparation tool.
    • Install SharePoint 2010 and run the SharePoint Products Configuration Wizard.
    • Configure a server farm topology. For example, configure a Single Server Farm.
    • Create and configure a new Search Service application.
  2. Download and install Adobe PDF iFilter 9. For more information about how to download PDF iFilter 9, see Adobe PDF iFilter 9 on the Adobe Downloads website.

  3. Download the Adobe PDF file icon. For more information, see Use of Adobe icons and web logos on the Adobe website.

    Note Save the Adobe PDF file icon to the following file location:

    \Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\IMAGES\
  4. Add the mapping entry to the docIcon.xml file. To do this, follow these steps:
    1. Open the docIcon.xml file in Notepad.

      Note The docIcon.xml file is located in the \Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\XML folder.
    2. Type the following entry in the docIcon.xml file:

      <Mapping Key="pdf" Value="pdf16.gif" />
    3. Click Save.
    4. Exit Notepad.
  5. Add the .pdf file type to the SharePoint content index.
  6. Click Start, type regedit in the Search programs and files box, and then press Enter.
  7. Locate the following registry key:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\14.0\Search\Setup\ContentIndexCommon\Filters\Extension
  8. Right-click Extension, click New, and then click Key.
  9. Type .pdf, and then press Enter.
  10. Click .pdf, right-click (Default), and then click Modify.
  11. Type the following GUID in the Value data box:

    {E8978DA6-047F-4E3D-9C78-CDBE46041603}
  12. Exit Registry Editor.
  13. Restart the SharePoint Search Service.
  14. Restart all the SharePoint servers in the server farm.

PowerShell 2.0 Adding Columns to Document Libries in a Site Collection.

Adding Columns to a SharePoint List across an entire Site Collection should be done like this using PowerShell (with Power GUI):
 
Note that the use of the following works with all the defaults... 
$fieldDateTime = [Microsoft.SharePoint.SPFieldType]::DateTime
$list.Fields.Add("Compliance Date",$fieldDateTime,$false) 

However, you get MORE Control over Field Attributes using this method:
$fldXml = "<Field Type='DateTime' DisplayName='Report Sign Off Date' Format='DateOnly' Name='Report Sign Off Date'/>"     
$list.Fields.AddFieldAsXml($fldXml) 
 
Both methods are used in the code block below. 
if ((Get-PSSnapin | ? { $_.Name -eq "Microsoft.SharePoint.PowerShell" }) -eq $null) {
    Add-PSSnapin Microsoft.SharePoint.PowerShell
}
[Microsoft.SharePoint.SPSecurity]::RunWithElevatedPrivileges( 
{
 $site =  Get-SPSite -Identity "https://mysite.com/sites/thissite"
 Write-Host "Script Started"
 [array]$ListNames = "ListA", "ListB"
 $NumberofReportsinRecordFound = $false
 $ReportSignOffDateFound = $false
 $ComplianceDateFound = $false
 foreach($web in $site.AllWebs)
 {
  #Get number if Lists rather than using foreach as we will be modifying the List
  
  for($i=0; $i -lt $web.Lists.Count; $i++)
  {
   $list = $web.Lists[$i]
   if($list.BaseType -eq "DocumentLibrary" -and $list.BaseTemplate -notmatch "Catalog")
   {
    Write-Host $web.Title
    Write-Host $list
        
    $NumberofReportsinRecordFound = $false
    $ReportSignOffDateFound = $false
    $ComplianceDateFound = $false
      
    if($ListNames -contains $list.Title)
    {
     for($j=0; $j -lt $list.Fields.Count; $j++)
     {
      $field = $list.Fields[$j]
      if($field.Title -like "*do not use*")
      {
          Write-Host "do not use deleted!"
       $list.Fields.Delete($field)
       $list.Update() 
      }
      
      if($field.Title -like "Number of Reports in Record")
      {
       $NumberofReportsinRecordFound = $true
      }
      if($field.Title -like "Report Sign Off Date")
      {
       $ReportSignOffDateFound = $true
      }
      
      if($field.Title -like "Compliance Date")
      {
       $ComplianceDateFound = $true
      }
     }
        $fieldNumber = [Microsoft.SharePoint.SPFieldType]::Number

     if(!$NumberofReportsinRecordFound){
      $list.Fields.Add("Number of Reports in Record",$fieldNumber,$false)
      $fld = $list.Fields["Number of Reports in Record"]
     }
     
     if(!$ReportSignOffDateFound){
      $fldXml = "<Field Type='DateTime' DisplayName='Report Sign Off Date' Format='DateOnly' Name='Report Sign Off Date'/>"
      $list.Fields.AddFieldAsXml($fldXml)
     }
     
     if(!$ComplianceDateFound){
      $fldXml = "<Field Type='DateTime' DisplayName='Compliance Date' Format='DateOnly' Name='Compliance Date'/>"
      $list.Fields.AddFieldAsXml($fldXml)
     }
     $list.Description = "Inspection Reports"
     $list.Update()
    }
   }
  }
 }
 $web.Dispose()
 $site.Dispose()
 Write-Output "Script Ended"
}
)

Databases running in compatibility range, upgrade recommended.

When you apply a hot fix to SharePoint 2010 you need to run a command to complete the patch otherwise you will see this message in Central Admin "Databases running in compatibility range, upgrade recommended" under Upgrade and Migration -> Review database status, under the Status column.

To resolve this issue you need do the following.
1. Open an Administrative command prompt. CMD - Run as Administrator, or open the SharePoint PowerShell Command Window.
2. If running just the normal PowerShell Command Windows, change directory to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN
3. Run PSConfig.exe -cmd upgrade

More information can be found here: http://technet.microsoft.com/en-us/library/cc263093.aspx

Hotfixes/Cummulative Updates: http://technet.microsoft.com/en-us/sharepoint/ff800847.aspx#LatestUpdates

SharePoint Error: "Additions to this Web site have been blocked."

I came across this error today! I'm not sure how this was set but someone must have set the "Site Collection Quotas and Locks" property to Read-only.

Central Admin -> Application Management -> Site Collections -> Configure quotas and locks.

and change this section to "Not locked". 

Hope this help someone!

HTTP to HTTPS Redirect on IIS7

Redirecting all HTTP traffic to HTTPS for a single site on IIS7 is as simple as the following steps.

1. Install Microsoft URL Rewrite Module if not already installed

2. Install your SSL certificate as Normal.
(Note that you need to keep a hostname-less port 80 entry in the Bindings, as well as port 443 for SSL, in order for the redirect to work.)

3. Add the following XML to your Web.Config file. 

  <system.webServer>
    <rewrite>
    <rules>
      <rule name="HTTP to HTTPS redirect" stopProcessing="true">
        <match url="(.*)" />
        <conditions>
          <add input="{HTTPS}" pattern="off" ignoreCase="true" />
        </conditions>
        <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
      </rule>
    </rules>
    </rewrite>
 </system.webServer>

4. Do a IISRESET

5. Test the URL to ensure http redirects to https. Also test not entering a http at all, just the website host name.

6. Done.