Joel's SharePoint Architect Blog

SharePoint 2010, MOSS & WSS Tips and Consultancy Tales

Subscribe Subscribe  View Joel Jeffery's profile on LinkedIn
joelblogs.co.uk | joelj.co.uk | joeljeffery.co.uk | jfdiphoenix.co.uk

Posts Tagged ‘SharePoint 2010 Training’

Despite protests from music lovers, here is another of the songs from my SharePoint Show.

This is a mix from several live versions. In this song we visit what you can and can’t do in the Sandbox, and the several ways in which the User Code Service protects our server from the evils of any user code that tries to run a “Bad Command”.

Apologies to Lady Gaga, and all those who have been affected by issues in this video.

Technorati Tags: SharePoint, SharePoint 2010 Training, SharePoint Administration, SharePoint Architecture, SharePoint Development, SharePoint Videos

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")
    }%MINIFYHTML930900777a9efd7ee206c8614c06f50415%

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://joelblogs.co.uk/wp-content/uploads/2012/03/Disable-CRLCheckv2.zip.

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

Technorati Tags: SharePoint, SharePoint 2010 Training, SharePoint Administration, SharePoint Administrator

Here’s a common use case: a user in your company is complaining about how frequently they receive Alerts from content added to SharePoint 2010 Lists.

Yes, there are quite a few tools out there, and some folks suggest using Control Point or something expensive for this requirement. But in principle you don’t need those tools.

SharePoint 2010 is best administered by PowerShell. Here’s an example script that will reset all of the alerts for a specified user (e.g. “DOMAIN\JOEL”) to receive a weekly digest.

Start-SPAssignment –Global

Get-SPWeb http://sharepoint/* | ForEach-Object { $w = $_; ForEach($alert in $w.Alerts) { if($alert.User.UserLogin -eq “domain\joel”) { $alert.AlertFrequency = “Weekly”; $alert.Update(); } } }

Stop-SPAssignment -Global

Enjoy!

Post Script:

Top tip from Andrew, one of my students. Why not train users to manage alerts for themselves? Outlook has the Manage Rules & Alerts feature to make the task easier:

Manage SharePoint Alerts from Outlook

 

Technorati Tags: PowerShell, SharePoint 2010, SharePoint 2010 Training, SharePoint Administration

After much persuasion, I’ve decided to fly in the face of public opinion and record one of the songs from my SharePoint show Smile

Stop, Collaborate and Listen:
SharePoint’s Back with a Brand New Invention.

Technorati Tags: Comedy, Development, SharePoint, SharePoint 2010 Training, Songs, Videos

I was recently asked how to remove the Editor Parts (Appearance, Layout, Advanced, etc) from custom Web Parts.

One strategy is to implement your own Editor Part and mark the built-in ones as not Visible.

Firstly, we need to create our Editor Part class:

class MyEditorPart : EditorPart
{
    protected override void CreateChildControls()
    {        // this line hides the default EditorParts
        Parent.Controls[2].Visible = false;
        base.CreateChildControls();
    }

    public override bool ApplyChanges()
    {
        // do stuff here
        return true;
    }

    public override void SyncChanges()
    {
        // do stuff here
    }
}

And here’s how we invoke our Editor Part from our Web Part:

public class MyWebPart : WebPart
{
    public override EditorPartCollection CreateEditorParts()
    {
        ArrayList aryParts = new ArrayList();

        MyEditorPart myEditor = new MyEditorPart();
        myEditor.ID = this.ID + "_myEditorPart";
        aryParts.Add(myEditor);

        return new EditorPartCollection(aryParts);
    }
    // do more stuff here...
}

Hopefully, when you edit the Web Part it should look something like this:

The next step would be to extend CreateChildControls(), ApplyChanges() and SyncChanges() to get and set any properties you’d like to allow users to edit.

Technorati Tags: Development, SharePoint, SharePoint 2010 Training, SharePoint Developer, SharePoint Development, WebParts