Wednesday 8 September 2010

DisableLoopbackCheck fix

I was listening to Todd Klindt's netcast 50 this morning and he mentioned that DisableLoopbackCheck is not the correct approach for allowing your SharePoint servers to see themselves (needed if crawling).  I have been doing this on my server installation and need to review my approach.

MS KB on disabling loopback using either approach.  DisableLoopback was introduced by MS to reduce prevention attacks.  As SharePoint needs to crawl itself and it's pretty nice to have a local browser for A records/renamed resources, I need to disable loopback however, the method of specify what to disable is definately more preferable.

Tuesday 7 September 2010

SP2010 AutoSPInstaller NLB farm install issue - Trial period for this product has expired

Problem: I created a farm using the AutoSPInstaller project. All works perfectly. I then joined a 2nd SharePoint 2010 server using the script however the script was change to not create the services again. All works and I have a 3 server farm including the database server. I then added Windows 2008 R2 network load balancing on the 2 SharePoint 2010 servers. If try access the default Team Site created when I built the 1st server on the new server I get the error "The trial period for this product has expired." Event log doesn't show an error and the ULS shows the following error "Exception thrown while adding control 'Microsoft.SharePoint.Portal.WebControls.SearchBox' : Thread was being aborted ...".


Hypothesis: The install adds the IIS web site created on my initial farm build on the 2nd SharePoint server. Routing is working and the error occurs when the request is routed to the 2nd SP2010 server. The response is coming from the IIS web server and we know the issue is within the specific web app.  In MOSS there were 2 causes for the error message and this is clearly not the SP2 bug so it looks more like the app pool account bug.

Resolution: Create a new Web Application and create a new root Site Collection. The error goes away. OR
Using Powershell change the Managed account then using IIS Manager on each web server go to the approoriate app pool and change the account to the new account. 
OR
Use Central Admin to change the service account.  CA > Security > Configure service account.  You will need to reset IIS on each web server.
Demo on changing app pool managed accounts

Friday 3 September 2010

SharePoint 2010 PowerShell Useful Scripts

Get Content Types in a Site collection
$site = new-object Microsoft.SharePoint.SPSite(http://ww3.sp.demo.dev/)

$web = $site.rootweb.ContentTypes
ForEach ($id in $web)
{
'"' + $id.Name + $id.Id + '"' Out-File "d:\logfiles\contenttypes.txt" -append
}

Delete a List Instance
$site = new-object Microsoft.SharePoint.SPSite(“http://demo.dev/”)
$web = $site.rootweb
$list = $web.Lists["Orders"]
$list.Delete()
 
Run all time jobs 
$timers=Get-SPTimerJob|{$_.isDisabled -eq $false}
foreach ($timer in $timers) {$timer.RunNow()}
View ULS data for a CorrelationId
PS C:\Users\PaulB> get-splogevent ?{$_.Correlation -eq "fe45a7cd-e91b-4ad3-80dc-50cd2a238c6a"} select Area, Category, Level, EventID, Message Format-List 
Run the SharePoint Health Analyzer
$jobs = Get-SPTimerJob | Where {$_.DisplayName -match "Health Analysis Job"}
foreach($job in $jobs) {
  Write-Host "Running" . $job.DisplayName
  $job.RunNow()
}

Read an XML file:

Not all jobs are fired automatically so you can run all the SP Health Analyzer jobs using this PS cmd.  Ensure server can deal with extra load (run out of hours if possible).
Ari Bakker

Turn On-Off Publishing Workflow
John Livingston
PowerShell Basics
Zach Rosenfield's - Farm settings, retrieve solutions, basic SharePoint operations
Gary Lapointe
Blog

Brian Lalancette
AutoSPInstaller - Installation of SP2010
Use Windows PowerShell to Display Service Dependencies

Adam Preston
Blog
Disable Loopback in IE - New-ItemProperty HKLM:\System\CurrentControlSet\Control\Lsa -Name "DisableLoopbackCheck" -Value "1" -PropertyType dword

Todd Klindt
Blog

PowerGui
PowerGui SharePoint reference card
Download PowerGui

Add the SP cmdlets to PS window
Add-PSSnapin Microsoft.SharePoint.PowerShell

Get Help about PS Cmds
PS> Get-Help Get- SpWebapplication
http://thuansoldier.net/?p=1559

Updated: 23 Oct 2012
Add a local user account

Add an account to AD and add the account to a group.

Apologies if I have ripped script directly.  I don't have the source for a lot of the work these help scripts are based.  On pls let me know if I need to credit a source.
 

Wednesday 1 September 2010

SP2010 AutoSPInstaller Prerequisite Install Issues (Codeplex PS project)

Problem: Install SP2010 using the CodePlex PowerShell Installer (AutoSPInstaller) without internet access.

Hypothesis: 
Add the following KB to the prerequisiteInstaller folder:
  • Windows6.0-KB968930-x64.msu (/POWERSHELL)
  • Windows6.0-KB976394-x64.msu (/KB976394)
  • Windows6.1-KB976462-v2-x64.msu (/KB976462)
  • Windows6.0-KB974405-x64.msu (/IDFXR2)
  • rsSharePoint.msi (/ReportingServices)
  • SpeechPlatformRuntime.msi (/Speech)
  • MSSpeech_SP_en-us_tele.msi (/SpeechLPK)
=====

Error: Error.  An unknown error occurred installing prerequisites at c:\....\AutoSPInstaller.sp1:388 char:14 ...

Fix: Reboot server and retry.

=====

Error: The tool was unable to install SQL 2008 R2 Reporting Services SharePoint 2010 add-in. Install process returned (0X643=1603).  Applies to the codeplex Powershell scripted install.
Fix: Only info I found suggested a re-run fixes the error. Simply re-running the prerequisite installer did not fix the issue for me. A similar error suggesting that i am using the incorrect version of rsSharepoint.msi relating to the Genva framework (claims) not Reporting Services.  I tried manually installing the Reporting services rsSharePoint.msi, it kept failing.  I also tried rsSharePoint_x64.msi, also failed.
Next I ran SharePoint install manually after the manual prerequisites was run as Administrator, failed.

Noticed I had 2 rsSharePoint.msi that are of a different size?  The file I used on 2 Sept 2010 on my Win 2008 R2 WFE was 36.9MB in size, my other was 39MB.  rsSharePoint.msi download

I use the version off the SQL media for getting Reporting Services wirking in the SharePoint mode.

=====

Error: rsSharePoint.msi wont install
Fix: There are version versions of rsSharePoint.msi, ensure you use the correct 36.9MB file.
I downloaded the correct version from http://go.microsoft.com/fwlink/?LinkId=192588
Incorrect 39MB Version as of 2 Sept 2010 .
These file have the same name but they are different and using Windows 2008 R2 for my install only the 36.9MB version works.

=====

Installation Notes for a 3 server NLB SharePoint 2010 farm

Tuesday 31 August 2010

SharePoint 2010 Prerequisite Installation

Problem: SP 2010 has to have prerequisites run that setups and installs software components.  This can be run by clicking the prerequisiteInstaller.exe or via a cmd prompt.  The cmd prompt option is useful for unattended installs.  Additionally the prerequisite installer will access the internet to download the required files, my environment does not have Internet access.

Initial Hypothesis: Download software onto the WFE servers and run the prerequisites to use local copies of the software that is required.

Resolution:
  • Extract SP2010 onto the local WFE
  • Open the PrerequisiteInstallerFiles folder and copy msi's & exe's (Minimal files would be: sqlncli.msi, mschart.exe, dotnetfx35setup.exe, Syncronisation.msi, FilterPack64bit.exe, SQLServer2008_ASADOMB10.msi)
  • Open a cmd prompt and run as an Administrator.
  • Navigate to the appropriate directory using Windows explorer where PrerequisiteInstaller.exe is and create the file PrerequisiteInstaller.Arguements.txt
  • Edit the PrerequisiteInstaller.Arguements.txt file as shown below.  Save and close the files.
  • Navigate to the appropriate directory using the cmd prompt where PrerequisiteInstaller.exe is located and run the cmd "PrerequisiteInstaller.exe".  Mine is c:\Software\SP2010>PrerequisiteInstaller.exe

Tip: The Prerequisiteinstaller.Arguements.txt must not have line breaks between switch statements only spaces.  I.e. the config must be on 1 line.

PrerequisiteInstallerArguements.txt:
/unattended /SQLNCli:PrerequisiteInstallerFiles\sqlncli.msi /ChartControl:PrerequisiteInstallerFiles\MSChart.exe /NETFX35SP1:PrerequisiteInstallerFiles\dotnetfx35setup.exe /Sync:PrerequisiteInstallerFiles\Synchronization.msi /FilterPack:PrerequisiteInstallerFiles\FilterPack64bit.exe /ADOMD:PrerequisiteInstallerFiles\SQLSERVER2008_ASADOMD10.msi

More Info:
Create an "offline" SP2010 prerequisite installer
Prerequisite cmd config options
Pre-requisite software lists
SP2010 install cmd-line args


Monday 30 August 2010

Linq to SharePoint 2010 DSL extensions

I have been building a composite application for a client that has a heavy reliance on SPMetal.  There are several issues using SPMetal and I have spent time this weekend trying to figure out how SPMetal works so I could work around our issues.  I found this project from MS LINQ to SharePoint DSL extensions.  Pretty impressive tool.

A few years back I went to Microsoft to hear about Domain Specific Languages (DSL), at the time I thought it was pretty amazing but couldn't see any benefit for me and thought it was going to be pretty niche in fields like academic research.  I was wrong and this project is definitely worth a look it you are going to use SPMetal, you may not need or want the extra ability but pretty useful.  Olivier Carpentier has written a good user guide & made a pod cast to go along with the unsupported MS project.

Thursday 26 August 2010

Creating lookup columns and list declaratively in SP2010

Problem: When creating lists via a feature, you may want to link SharePoint 2010 lists.
Initial Hypothesis: In MOSS to link to SharePoint 2007 lists you had to do it via the UI or via a deployable feature.  The list was created declaratively using XML (CAML).   Lastly the lookup column needed to be created using a feature receiver.  As in MOSS, in SP2010 you can create a lookup column using the UI but this is not a reusable deployment method and falls prey to errors.  SP2010 allows you to create lookup lists using declarative CAML.

Resolution: Create the lists, add site columns (fields), then add the site columns to a content type and lastly generate the list definition & list instance.  Steps are detailed below:
  • In an elements file declaratively create a lookup column that uses the specified list as shown below: 

  • Add the new lookup column to a content type:
  • Your existing/create a list definition that derives from your content type.
Note: The Lookup Site column needs to specify the list it is looking up when you declare the XML.
More Info:
Creating lists declaritively in SP2010 - Post outlines creating SharePoint lists, coupled with this post you can create lists that are related using a feature to create your lists.
Available field types