Showing posts with label SharePoint Server 2010. Show all posts
Showing posts with label SharePoint Server 2010. Show all posts

Monday, 2 July 2012

Uninstalling SharePoint Diagnostic Studio 2010

How to uninstall SharePoint Diagnostic Studio 2010

SharePoint Diagnostic Studio 2010 is actually part of the SharePoint 2010 Admin Tookit.


To uninstall a specific tool from the SharePoint 2010 Administration Toolkit
1.  From Programs and Features, select the Microsoft SharePoint 2010 Administration Toolkit and click Change.
The same dialog box is displayed if you run the SharePoint2010AdministrationToolkit.exe file instead of using Programs and Features.
2. Select the tool you want to remove.
3. Click Next, and then click Finish.

Detailed here : http://technet.microsoft.com/en-us/library/cc508848


Note : installing the tool provisions a solution globally "extendeddiagnosticproviders.wsp", this is not removed when you un-install the tool.



Also note, SharePoint Diagnostic Studio (SPDiag) 2010 can place significant load on SharePoint servers
http://support.microsoft.com/kb/2655725

MS say :
Using the SharePoint Diagnostic Studio (SPDiag) 2010 can consume significant network bandwidth and other resources on the server being monitored as well as on the database server used to host the project database.
Evaluate the need to have the toolkit installed.
Uninstall the SharePoint Diagnostic Studio 2010 if it is not required.


It's nice to have clean working performing environments.

Sunday, 29 April 2012

Sharepoint webpages slow to load (SPCertificateValidator.Validate) long execution time

Has been a week of make, break, fix and make it faster.
Performance issues with SharePoint can be caused by many issues. This is one small avoidable issue that can help improve the page load speeds.

As a general rule the first thing to start with when troubleshooting performance issues with web page loads times, is to enable the developer dashboard. This will give you a break down of the components the page loads and the associated load times.
To enable the Dev Dash : http://workingsharepoint.blogspot.co.uk/2012/03/developer-dashboard.html

One item we found consistently coming up with a long load time (20s) during testing was the following. (SPCertificateValidator.Validate). Execution Time=20034.2566316328

A quick explanation of this is that a component on the page is trying to check the validity (CRL check) of the "SharePoint Root authority" certificate. As it cant find it in the Trusted root certificates, Windows tries to retrieve the CRL from the net and causes the delay.
See the MS article for a full explanation.



Solutions to this are to do one, or both if a test environment, on your WFE servers.
This comes straight from the MS article which is referenced below.

A> Install the SharePoint Root Authority certificate in the Trusted Root Certification store.

1. Obtain the “SharePoint Root Authority” certificate as a physical (.cer) file
   a. Launch the SharePoint 2010 PowerShell window as Administrator
   b. $rootCert = (Get-SPCertificateAuthority).RootCertificate
   c. $rootCert.Export("Cert") | Set-Content C:\SharePointRootAuthority.cer -Encoding byte

2. Import the “SharePoint Root Authority” certificate to the Trusted Root Certification store
   a. Start | Run | MMC | Enter
   b. File | Add/Remove Snap-in
   c. Certificates | Add | Computer account | Next | Local computer | Finish | OK
   d. Expand Certificates (Local Computer), expand Trusted Root Certification Authorities
   e. Right-click Certificates > All tasks > Import
   f. Next | Browse | navigate to and select C:\SharePointRootAuthority.cer | Open | Next | Next | Finish | OK



B> Disable the automatic update of root certificates on the SharePoint Servers.

1. Launch gpedit.msc as a local administrator.
2. Go to Computer Configuration | Windows | Security settings | Public Key Policies | Certificate Path validation settings.
3. On the Network Retrieval tab, define the policy and uncheck “Automatically update certificates in the Microsoft Root Certificate Program”
4. Run gpupdate /force for the policy to take effect immediately.


In our development environment we enabled both as there is a minimal risk but is not reccomended for any public facing Production Environment.
The article was for a search page but in our case was happening on the Home page of our site so this helped increase the page loads time by around 20 seconds.


MS Article : Search results are returned much slower intermittently
http://support.microsoft.com/kb/2639348

Wednesday, 18 April 2012

Move SharePoint content to another Farm by backing up and restoring the SQL DB


At some point you will need to restore/move/backfill content from a Production Farm to a test or developer Farm.
You can do this by copying the SQL DB to your test SQL server and reattaching the DB in CA to the Target web application.

A few things to remember :
You will have to have the same solutions deployed on your target Farm.
Check the dependencies of any service applications i.e. Managed Metadata Service & others...
Make sure you have the same SQL server versions on target and source.

These instructions are for SQL Server 2008 R2 and SP 2010.
It is also possible to do this via PS, check the article at the end for further details.


On SQL Server
Get the current SQL permissions set on your target SQL DB.

Check the permissions set on the DB.

1.      SQL DB Properties > Files > Owner > record the account listed
2.      SQL DB Properties > Files > Permissions > record the accounts listed
3.      Security > Logins > accounts from step 2 >  Properties > User Mapping > select the target DB name > select source DB > record Permissions listed

Create a SQL DB backup of your Source web application DB.
Right click your target DB > Tasks > Backup > Backup type > select Full
Under Destination > Click remove > Click add > File name > browse … > Select your backup dir > enter a relevant filename > click ok > ok
Click OK to kick off your backup.
Copy the source SQL DB backup to your Target SQL Server.


To have a recovery option in case this doesn’t work. Backup your target SP web application DB either in SQL or via a SP Farm backup, both if you want to cover all bases.



On your SP Farm
At this point I normally stop the IIS sites on all SP WFE’s that use this target SQL DB to try stop connections to the DB’s. timer jobs may still kick off though.

On your target SP Farm, navigate to > Central Admin > application management > Databases > Manage content databases > Select you web application > select the target DB Name.
Select “Remove content DB” > OK


On SQL Server
On the target SQL server, restore the source DB over the Target DB
Check there are no connections to the source DB.
In SQL mgmt Studio, right click the server > Activity monitor > expand processes > filter by target db > right click and Kill Process on any connections.
Close the activity Monitor pane.

Right click your target DB > Tasks > Restore > Database.
Under To Database > ensure the target DB is selected.
Unser Source for restore select From Device > browse … > backup media File > Click Add > browse to backup location and source DB Backup file > click ok > Ok
Select the backup sets to restore > check the box
Select Options on the left > restore options > Overwrite the existing DB (with replace)
Click OK to kick off the restore.

Once completed, refresh the DB view, right click the restored DB > Files > Change the Owner to the correct account listed in step 1. Above (normally your SP farm account)
Click ok
Expand the target DB > select security > Users > remove any accounts from your source SP farm.

From the top level of SQL mgmt Studio, Select the server > Security > Logins > Select the equivalent account listed above in step 2. for your target SP Farm.
Right click > properties > user mapping > Users mapped to this login > select the target DB name > enable the permissions listed from step 3. above > click OK.

Your target DB should now have the same permissions set as before the restore.


On your SP Farm
On your target SP Farm, navigate to Central Admin > application management > Databases > Manage content databases > Select you web application > click “Add a Content DB”
Ensure the correct Web application and Database Server is listed.
Under “Database Name” Enter the target DB name.
Enter any configuration specifics, if any for the rest of the DB settings.
Click OK.

Your restored DB should now be attached successfully.
Start all IIS sites that use the Target DB’s is you stopped them.
Reset IIS on your WFE’s if you can.  
If you have a warm up script for your target web application, run this then access the site.

The site should eventually come up, if you got all your SQL permissions correct.
It can be really slow sometimes so be patient.


Natalia Tsymbalenko has some common errors in this useful article.
How restore a SharePoint 2010 content database on the different farm :

Tuesday, 17 April 2012

Configure BLOB cache settings in SharePoint 2010


Blob cache is a quick and easy way to speed up your SharePoint site.
Here’s the MS blurb
A BLOB cache is a disk-based cache that stores binary large objects (BLOBs) such as frequently used image, audio, and video files, and other files that are used to display Web pages. Each front-end Web server maintains its own BLOB cache. When you enable a BLOB cache, you specify the file types to include in the cache and also the location of the BLOB cache. The first time that a BLOB file is requested, the file is copied from the database to the BLOB cache on the front-end Web server. Future requests to the front-end Web server for that same file are then served from the file that is stored in the BLOB cache, instead of being served from the database. This reduces the network traffic and the load on the database server.


To Enable Blob Cache

1. Make a copy of your web.config, open the live web.config

2.   Find the line <BlobCache location="" path="\.(gif|jpg|jpeg|jpe|jfif|bmp|dib|tif|tiff|ico|png|wdp|hdp|css|js|asf|avi|flv|m4v|mov|mp3|mp4|mpeg|mpg|rm|rmvb|wma|wmv)$" maxSize="10" enabled="false" />

3.  Change the location to a location that exists on each of your WFE’s. (Each WFE will have a cache dir, doesn’t have to be a share)

4.  Amend which files you want to cache by removing those you don’t want to cache.

5. Change the maxsize variable to something your drive location can cater for, size is in GB. (Note each IIS website will use this value, 3 sites = 30GB if set to 10)

6. Change the enabled attribute to “true” from “false”

7. Save the web.config file and load your site.

8. Check the blob cache gets created on each WFE.



To Flush the BLOB cache (SharePoint Server 2010)

When you flush the BLOB cache, you clear the contents of the BLOB cache for a Web application. This is useful if the BLOB cache becomes out of sync with the content. For example, after you restore a content database, the BLOB cache will be out of sync with the content. To correct that situation, you must flush the BLOB cache.

Create a PS script file containing the following.

$webApp = Get-SPWebApplication "<MyWebApplicationURL>"
[Microsoft.SharePoint.Publishing.PublishingCache]::FlushBlobCache($webApp)
Write-Host "Flushed the BLOB cache for:" $webApp

Save the file “FlushMyWebApplicationURL”, and test run it to see that the Blob Cache gets deleted.
Test show this  updates the files in the blobcache dir but doesn’t remove all the files entirely.


 More info on the MS site here : 

How to fix SharePoint Foundation event id 7043

On Windows 2008 R2, you may receive the following error message multiple times in the application event log.
This can be ignored or you can fix with the quick change below.

Error details :

Event ID: 7043

Load control template file /_controltemplates/TaxonomyPicker.ascx failed: Could not load type 'Microsoft.SharePoint.Portal.WebControls.TaxonomyPicker' from assembly 'Microsoft.SharePoint.Portal, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.




To fix this :

1.Navigate to /14/TEMPLATE/ControlTemplates/TaxonomyPicker.ascx user control on each WFE server.
2.Open the user control in a text editor and locate the first line
3.Find the character string &#44; and replace with a comma ‘,’ (without quotes).
4.Save the user control

I have had occasions where the fix has been implemented but still get the error. Then fell back to the line in the MS article below.
"This message should be treated as log noise and can be ignored."

MS article :
http://support.microsoft.com/kb/2481844


Monday, 16 April 2012

Setting SQL Server Alias Names in SharePoint 2010

Setting up a SQL Alias name is useful if you have multiple farms in virtual environments. It helps as you always reference the same SQL alias and when you are moving DB's between different SQL Servers.

Ideally this needs to be done on all WFE & App servers, before installing SP and setting up your Farms.
Not required on your SQL server though.

1. Start “C:\windows\system32\cliconfg.exe”
Select the tab “Alias” and click the button “Add”.
Select “TCP/IP” and define the name of the alias "SPSQLSrv". The fill in the hostname of your database server and select the “Dynamically determine port”-checkbox. After that click “OK”.

If you running 64 bit, Start “C:\windows\syswow64\cliconfg.exe”
personally even though running 64 bit, i have had it working just using the 32bit version. never hurts to be thorough though.

2. Now on each SharePoint Server, create your new farm using the Sharepoint Products Configuration Wizard. Use the defined sql alias name as your database server. "SPSQLSrv"

Tuesday, 10 April 2012

Installing MS ForeFront Protection 2010 for SharePoint



Pre Req's : 

  • Create a new Forefront admin account: SPForefrtadm (careful on account name length as have had problems)
  • Make account SP farm admin (not good i know but req)
  • Add account to server(s) local administrator & WSS_ groups.
  • Add account to SQL server with roles dbcreator, public, securityadmin

One last thing  here, I got the following error when installing


This appeared in the event log : 

Insufficient SQL database permissions for user 'Name: domain\spforefrtadm SID: S-1-5-21-4128845870-1776218058-854377484-3634 ImpersonationLevel: None' in database 'SharePoint_Config_name' on SQL Server instance 'servername'. Additional error information from SQL Server is included below.

The SELECT permission was denied on the object 'Versions', database 'SharePoint_Config_name', schema 'dbo'.

  • So looks like it requires dbo SQL permissions on the Config DB too.

This is so wrong MS! sort it out!!


To Install Forefront for SP ::

 Run forefrontsharepointsetup.exe  (needs to be installed on each server, one at a time)
Accept licence agreement > Next > Next
Change data folder locations to d:\path
Enter proxy details (if req)
Enter SP farm account (SPForeFntAdm) & PWD > Next
Do not use MS for updates, or do if you have a mgmt server > Next
Do not join customer experience > Next > Next
Click close to finish.
Run the "Forefront protection for SharePoint console"
Click “Activate now”
Enter the licence key : enter your lic
Enter agreement details ::
Licence Agreement number:
EXP DATE:

Repeat on each WFE\ Application servers.


To Configure the Forefront AV you may want to consider the following :
Select policy management > Antimalware > Realtime
Once installed, Set process count to "2", Maximum container scan time to "60" seconds and click "save". (this saves a huge number of threads being used and a long wait time if problems during file scans)

Note this next step is not required but you may want to consider to avoid each AV scanner chewing up your sever memory and frankly a bit of AV overkill.
Select policy management > Global Settings > Advanced options > Engine Management
Under "intelligent Engine Management" Select "Manual" and Disable all but "Microsoft Antimalware Engine" and click "save"



Run whole process above on each server in turn as the CA web services are restarted. So don’t run the installs all at the same time.

Once done with installs, on your central admin server navigate to
Central Admin > Security > Manage AV settings
Set your required settings for the Farm AV.

optional : 
Antivirus Time Out
something short unless you like waiting

Antivirus Threads
2 unless you have lots of memory

Extract all your Sharepoint Solutions to disk

A neat "how to" with a good explanation to extract all solutions from your SharePoint Farm.

Care of Shane Young :
https://msmvps.com/blogs/shane/archive/2011/05/05/using-powershell-to-export-all-solutions-from-your-sharepoint-2010-farm-and-other-fun.aspx

Thanks for clawing back hours from SharePoint and Dev hell

SharePoint Upgrade Failures


Recently I noticed that some servers in a Farm were listed as requiring an upgrade.
This process was used to resolve.
Don't forget to backup your Farm before trying anything.


Central Admin > Manage Servers in this Farm
Under status, two Servers were listed as "Upgrade required"

Reviewing the DB's showed that content DB's required an upgrade.
Central Admin > Upgrade and Migration > review DB status


To check further, from the hive folder run an upgrade check and pipe it to a file for review
stsadm -o localupgradestatus > c:\folder\upgradecheck.txt
Review the log file and find the section that Needs Upgrade
<status>Needs Upgrade</status>
This should list which components have an issue.


To resume a failed upgrade run the following, depending on your situation, on each server with the problem

psconfig.exe -cmd upgrade -inplace v2v -passphrase <insert-passphrase-here> -force
psconfig.exe -cmd upgrade -inplace b2b -passphrase <insert-passphrase-here> -force

v2v would be used for SharePoint 2007 databases placed in a SharePoint 2010 environment. 
For SharePoint 2010 databases in a newer patch level on a SharePoint 2010 environment you should use b2b
Check MS link below for psconfig ref on when to use -force option.



This still would not work and the error below occurred.

On step 3 I was getting the error "failed to create sharepoint timer service job to upgrade sharepoint products"
Logged in as the Setup account and re-ran the psconfig to resume the upgrade.
This time the following error occured.

####
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 -20120320-184525-16 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.
####

Sharepointgeoff advises to Resolve:

1. stsadm -o setproperty -pn command-line-upgrade-running -pv No
2. IISReset
3. Restart the Windows SharePoint Timer (cmd window : net stop sptimerv4, then net start sptimerv4)
4. psconfig –cmd upgrade –inplace b2b –wait –force (or v2v, whatever was run above)


Then ran the SP wizard on the servers in question and voila, happy SP servers.




Psconfig command-line reference (SharePoint Server 2010)
http://technet.microsoft.com/en-us/library/cc263093.aspx

Resume upgrade (SharePoint Server 2010)
http://technet.microsoft.com/en-us/library/ff382638.aspx

Relevant info ::
In some cases, you might have to restart upgrade to finish upgrading your sites from Microsoft Office SharePoint Server 2007 to Microsoft SharePoint Server 2010. For example:

During an in-place upgrade, if the server restarts or the upgrade fails, you must restart the upgrade process by using Psconfig.exe to upgrade the remaining sites.


During a database attach upgrade, any sites that cannot be upgraded will be skipped. After you have corrected any issues in the sites (such as a missing template or language pack, or the site being set to read-only or having exceeded its quota), you can restart upgrade by using a Windows PowerShell command to upgrade just the skipped sites.

SharepointGeoff : SPUpdatedConcurrencyException Fix when trying to install June 2011 CU for SharePoint Server
http://www.sharepointgeoff.com/spupdatedconcurrencyexception-fix-when-trying-to-install-june-2011-cu-for-sharepoint-server/

Friday, 23 March 2012

Converting Self-Signed Certificates into certificates with a Private Key that IIS can use


Enabling SSL on SharePoint test sites will display the standard IE or Firefox certificate error.
To avoid this and provide a smooth experience for test users you can generate a Self-Signed certificate and  convert this to a .pfx file that can be imported into IIS.

When generating self-signed certificates for test systems this method will allow you to get a self-signed certificate with Private Key

Generate a self-signed  cert and Private Key

Copy the Certificate and Private key to their own respective text file and save with relevant names.
Change the extension of the certificate to a .pem or .crt file


Convert to usable self-signed certificate including private key (Convert PEM To PKCS12 (PFX) Format)

Paste in the Private Key and self-signed certificate, create a password.
Download the .zip file containing the .pfx certificate with Private Key
This .pfx file can now be imported into IIS.

You will still need to import the .pem/.crt self-signed certificate into your own PC “Trusted Root Certification  Authorities > Certificates” certificate store.
This can be done manually or via Group Policy if required for a large environment.
This will prevent the certificate errors when accessing a SSL enabled SharePoint site in your test environments.


Wikipedia has more information on the file extensions used for SSL certificates here :
http://en.wikipedia.org/wiki/X.509

Thursday, 22 March 2012

Setting ADFS Token Expiration times.

The SAML token lifetime is set by the token issuer (resource ADFS Server). You may find that this is too short and want to extend it.

Note that the valid session time is set by the ADFS SAML TokenLifeTime and the LogonTokenCacheExpirationWindow in SharePoint.
The SAML TokenLifeTime always needs to be greater than the LogonTokenCacheExpirationWindow in SharePoint.

The formula to apply here is as follows.
Valid Session time = TokenLifeTime - LogonTokenCacheExpirationWindow




To change the session times


On the resource ADFS server
The following script example shows you how to change the lifetime of the SAML token issued by the "SharePoint Adatum Portal" relying party in ADFS to 480 minutes.

Add-PSSnapin Microsoft.ADFS.PowerShell
Set-AdfsRelyingPartyTrust –TargetName "SharePoint Adatum Portal" –TokenLifeTime 480

On the Resource SharePoint Farm
The following script example shows you how to change the LogonTokenCacheExpirationWindow in SharePoint to two minutes.

$ap = Get-SPSecurityTokenServiceConfig
$ap.LogonTokenCacheExpirationWindow = (New-TimeSpan -minutes 2)
$ap.Update();
IIsreset


SAML Token Expiration in SharePoint on this page is worth a read to understand the principles
http://msdn.microsoft.com/en-us/library/hh446526.aspx


To display the current ADFS relying party trust settings
Set-AdfsRelyingPartyTrust

To display the SharePoint Security Token Service Config
Get-SPSecurityTokenServiceConfig

Monday, 19 March 2012

SharePoint Website Warm up options

There are many warm up scripts and exe's that can run against your SharePoint environments to speed up the first time access to any site. These options have worked the best for our infrastructure. personally the first works well and has useful options.

Setup a scheduled windows task which launches your selection, running under an account that has relevant access, every morning before start of business. The web application is hit and every page iterated in the site.




SPWakeup : http://spwakeup.codeplex.com/
A simple application that touches each site and site collection on a Sharepoint or WSS server to rebuild the IIS cache.
This is compatible with Win 2008 R2 and SharePoint 2010, nice touch is the email letting you know it's been run.

Powershell Script : http://www.jonthenerd.com/2011/04/19/easy-sharepoint-2010-warmup-script-using-powershell/
The script loads the SharePoint plugin, enumerates the zones, and sends a request to each one.


MS Application Warm-up : http://forums.iis.net/t/1176740.aspx
The MS IIS team had a nice warm up optiont that i've used before, but this has been removed at present (19/03/2012)
Keep an eye on any new developments as it was a good option.
SP George had a good how to : http://sharepointgeorge.com/2010/warm-sharepoint-web-applications-windows-2008-r2-iis-75-application-warmup-module/



For reasons on why we get IIS resets and reasons to use Warm up scripts check out this link : http://social.technet.microsoft.com/Forums/en-US/sharepointadmin/thread/8547eaed-5420-4cca-af29-206d71898322/

Thursday, 15 March 2012

Setting up Kerberos Authentication for Sharepoint



To understand the basics, read the articles at the end of this how to. In short you permit your web service account to connect from a specified URL, to a specific Server with a specific SQL account.



For the SQL Service account

A : Manual Process For SQL
Open a cmd prompt with Run as (run as the domain admin account) or add the following with ADSI Edit.
Enter the following in the cmd prompt
setspn -A MSSQLSvc/servername.mydomain.tld:1443 mydomain\SQLserviceaccount
press enter

if successful enter the following
setspn -A MSSQLSvc/servername:1443 mydomain\SQLserviceaccount
press enter


B : Else, open ADSI edit
Browse to the SQL Server Service account used (mydomain\SQLserviceaccount)
right click > properties.
In the Attribute section, select ServicePrincipleName > click Edit
Add the following :
MSSQLSvc/servername:1443
MSSQLSvc/servername
MSSQLSvc/servername.mydomain.tld:1443
MSSQLSvc/servername.mydomain.tld


For the Web application Account

A : Manual Process
Open a cmd prompt with Run as (run as the domain admin account) or add the following with ADSI Edit.
Enter the following in the cmd prompt
Setspn -A HTTP/myURL.mydomain.tld mydomain\webappserviceaccount


B : Else, open ADSI edit
Browse to the Web Application Service account used (mydomain\webappserviceaccount)
right click > properties.
In the Attribute section, select ServicePrincipleName > click Edit
Add the following :
HTTP/myURL
HTTP/myURL.mydomain.tld

Note : it's always HTTP even if you site is HTTPS





Enable Constrained Delegation for the Web Application account

Browse to the web application Active Directory service account (mydomain\webappserviceaccount)
Edit the Object > Select the Delegation Tab > Trust this user for Delegation to any service (Kerberos only)
Click Ok



Test the Kerberos Setup

1. Setup a new site in Central Admin
Central Admin > Manage Web Applications > New
Select Claims Based Auth
Create a new IIS Site
Port : 80
HostHeader : enter name of site users will browse to
Edit Path to D:\etc...
Allow Anonymous : Yes
Enable Windows Auth : checked
Intergrated Windows Auth : checked and Negotiate (Kerberos) set
Create new Applicaiton pool : enter pool name or leave as default.
Select the Web application Service account : (mydomain\webappserviceaccount)
Amend you DB name if required.
Select OK to create the new web application

2. Create a site collection
Any site will do, use the same name as the host header and enter a site collection admin.
Click ok

3. Open DNS Manager > Create an A record for the Site name pointing to the IP i.e. MyURL
FQDN should be myURL.mydomain.tld

4. Open the Servers' Event Viewer > Select the Security logs > Filter the log to event ID 4624


5. Access the site from your PC browser : http://myURL
Check the Servers' Event Viewer for 4624 events, Logon Process and Authentication package should read : Kerberos


This is a really good site for further info : http://technet.microsoft.com/en-us/magazine/ee914605.aspx

These websites contain good explanations
http://www.thesharepointblog.net/Lists/Posts/Post.aspx?List=815f255a%2Dd0ef%2D4258%2Dbe2a%2D28487dc9975c&ID=43
http://blogs.msdn.com/b/russmax/archive/2009/10/20/configuring-kerberos-authentication-in-sharepoint-2010-part-1.aspx

The first was pretty clear to me and was used to create this page.

Wednesday, 14 March 2012

Developer Dashboard

The Developer Dashboard helps diagnose issues with custom code, load times and heaps more.


There are a few ways to enable/disable/ondemand it.
Note : you may need an IIS reset to see the developer dash appear / disappear


1. Powershell 

PS commands in blue

onDemand Mode (makes the icon available to expand the info window on each relevant page)
$service = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$addsetting =$service.DeveloperDashboardSettings
$addsetting.DisplayLevel = [Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel]::OnDemand
$addsetting.Update()

Enable for all
$service = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$addsetting =$service.DeveloperDashboardSettings
$addsetting.DisplayLevel = [Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel]::On
$addsetting.Update()

Remember to Turn Off
$service = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$addsetting =$service.DeveloperDashboardSettings
$addsetting.DisplayLevel = [Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel]::Off
$addsetting.Update()



2. STSADM

Run stsadm from command prompt in the hive\bin dir unless you have it as a path in windows.
hive = C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\

onDemand Mode
stsadm –o setproperty –pn developer-dashboard –pv “OnDemand”

Enable for all
stsadm –o setproperty –pn developer-dashboard –pv “On”


Remember to Turn Off
stsadm –o setproperty –pn developer-dashboard –pv “Off”


Sunday, 11 March 2012

AD Permissions on SharePoint Administrative accounts.

A common mistake that produces the various errors below on install or when adding service accounts to SharePoint.

Solution :
"Authenticated Users" should have "read" permissions on all Service accounts you add to SharePoint.
From the AD consol > edit the AD service account object > Security tab > Select "Authenticated Users" > ensure "Read" permissions are enabled.

Error on SP installation : 
Failed to create the configuration database.
An exception of type System.Collections.Generic.KeyNotFoundException was thrown.  Additional exception information: The given key was not present in the dictionary.
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)

Error on adding AD account as managed SharePoint account : 
The given key was not present in the dictionary.

Windows TIFF iFilter

Built-in Windows TIFF iFilter, simple to install and comes with Windows Server 2008 R2. 
permits you to index Tiff Files in SharePoint 2010

Install instructions :
Open Server manager > Features > Add Features > Windows TIFF iFilter > Next > Install.

Next,  check the Group policy to ensure OCR filter is enabled.
Open mmc > add group policy object snapin > Local computer policy > administrative templates > OCR > Force TIFF iFilter to perform OCR for every page in a document > edit > Enable.

Install on your SharePoint Servers doing the indexing the Farm.
In the case of a multi tier farm, if you have no compatibility concerns or security issues, install on all servers in the Farm in case you move the indexing role around.


Lastly, upload a .TIFF with some text, run an indexing job and check the search results.


Thanks to Mr Liu : http://johnliu.net/blog/2010/8/13/sharepoint-enable-ifilter-for-tiff-ocr.html

Monday, 5 March 2012

SharePoint 2010 Farm Backups via PowerShell

There are a few ways to do this but this method gave good results.

Overview :
Setup a share on a Server you will use to store the farm backups. This can be any one of your SP servers in the Farm. We normally backup to a share on the SQL box.
Setup scheduled tasks to trigger a batch file which runs the PS scripts to backup the farm, or cleanup the backups. This seems like an extra step but worked for me on Win 2008 R2 where nothing else would after a long day.
A good place to run this task would be an application server that most folk don't have access to as i set the script execution policy to unrestricted.



Pre-reqs :

Script execution status :
Check the server that you will be running the PS scripts on.
Ensure the execution policy for PS scripts are set to unrestricted.
(run PS as admin) PS commands in blue
To check : Get-ExecutionPolicy
To Set : Set-ExecutionPolicy Unrestricted


Setup your File share to store you backups :
Share the folder with the following settings
Everyone full access
NTFS permissions : SQL account & SP Admin account full access. (you need both accounts listed here)
Share name : \\Servername\FarmBackups



PS Scripts setup : 

Place you backup scripts in a relevant folder
\\Servername\FarmBackups\backupscripts


1. Setup a .bat file to be triggered by the scheduled task
File name : 1schedfarmbakup.bat
Insert the following line in the file and save. Batch file command in red
powershell -command "&{D:\FarmBackups\backupscripts\2backupSPfarm.ps1}"




2. Setup the powershell script file to backup the Farm.
File name : 2backupSPfarm.ps1
Insert the following lines and save
Add-PsSnapin Microsoft.SharePoint.Powershell
Backup-SPFarm -Directory \\Servername\FarmBackups -BackupMethod full -BackupThreads 10 -percentage 10 -verbose –force

Note : backup farm to specified directory using full backup with 10 threads, display the results every 10 percent verbosely and force the script to run even if there is not enough space on the drive. so make sure you have monitoring on you drive space!


3. Setup the bat file to clean out old Farm backups from the server.
File name : 3clean.bat
Insert line below and save
powershell -command "&{D:\FarmBackups\backupscripts\4cleanbackups.ps1 }"


4. Setup the powershell cleanup script

Filename  : 4cleanbackups.ps1
Insert the following, with correct path, in italic below, and your required number of backups and save

#///Start of ps script
# Location of spbrtoc.xml
$spbrtoc = "\\servername\FarmBackups\spbrtoc.xml"

# Days of backup that will be remaining after backup cleanup.
$days = 2

# Import the Sharepoint backup report xml file
[xml]$sp = gc $spbrtoc

# Find the old backups in spbrtoc.xml
$old = $sp.SPBackupRestoreHistory.SPHistoryObject |
? { $_.SPStartTime -lt ((get-date).adddays(-$days)) }
if ($old -eq $Null) { write-host "No reports of backups older than $days days found in spbrtoc.xml.`nspbrtoc.xml isn't changed and no files are removed.`n" ; break}

# Delete the old backups from the Sharepoint backup report xml file
$old | % { $sp.SPBackupRestoreHistory.RemoveChild($_) }

# Delete the physical folders in which the old backups were located
$old | % { Remove-Item $_.SPBackupDirectory -Recurse }

# Save the new Sharepoint backup report xml file
$sp.Save($spbrtoc)
Write-host "Backup(s) entries older than $days days are removed from spbrtoc.xml and harddisc."

#///end of ps script



Setup Scheduled tasks.

Login to the Server running the backups as SP setup account


Setup new task (Backup the farm)

General:
Name - Backup SharePoint Farm
Run whether user is logged in or not
Run  with highest privileges
Configure for : windows 2008 R2

Trigger :
Schedule
Daily at 18:00
Stop if runs longer than 5 hours (enter appropriate time)
Enabled

Actions :
start a program
Browse to the 1schefarmbackup.bat
Fill in appropriate start in dir

Conditions :
Start task only if computer is on AC

Settings :
Allow run on demand
Stop if runs longer than 3 days
If task does not end, force to stop.

Click OK to create task and enter PWD for SP Setup account.



Setup new task  (cleanup old backups)

General:
Name – Cleanup SP Farm Backups
Run whether user is logged in or not
Run  with highest privileges
Configure for : windows 2008 R2

Trigger :
Schedule
Daily at 04:00
Stop if runs longer than 2 hours (enter appropriate time)
Enabled

Actions :
start a program
Browse to the 3clean.bat
Fill in appropriate start in dir

Conditions :
Start task only if computer is on AC

Settings :
Allow run on demand
Stop if runs longer than 4 hours
If task does not end, force to stop.

Click OK to create task and enter PWD for SP Admin account.



Lastly, test your scheduled tasks and ensure the backup folders and .xml files are created on your share. Then check your cleanup scripts run successfully and cleanup the relevant folders a day or two later.



This came from somewhere but never kept the reference, apologies if came from you.

PowerShell script not running as Scheduled Task Server 2008
http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/0ea10ab8-8dd3-4c4c-977c-bbfd0bb17a1d/

PowerShell cheat sheet

Random basic commands I keep forgetting, this list will surely keep growing


Add the SharePoint snap in :

Add-PSSnapIn Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue


Set a path :

Set-location "path"

Output the PS command in a formatted table

"randomPS-command" | Format-Table –AutoSize

Check DB status for upgrade status

Get-SPDatabase | ?{$_.NeedsUpgrade –eq $true} | Select Name

Install SP Solution to all web applications  
Add-SPSolution -LiteralPath "c:\source\CodeMonkeySolution.wsp"

Install SP Solution to all web applications, to the GAC and force it in
Install-SPSolution -Identity CodeMonkeySolution.wsp -allwebapplications -GACDeployment -force

Adding and Removing dll's from the GAC using Powershell

To add a .dll to the GAC

Run the SharePoint PowerShell console as Administrator

type : Set-location <path to dll's here>

[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")

$publish = New-Object System.EnterpriseServices.Internal.Publish

$publish.GacInstall( <path>\RandomcodemonkeyDLL.dll)


 
To remove a .dll from the GAC

$publish.GacRemove( <path>\RandomcodemonkeyDLL.dll)





A good way of getting the names of you assemblies from  :
 Simplest way to get the strong name of an assembly
http://nileshmandekar.blogspot.co.uk/2012/03/simplest-way-to-get-strong-name-of.html


A very elegant way of getting the dll's in and out via script is like this from Fred :
http://fredericloud.com/2011/01/08/no-gacutil-no-problem/

AntiVirus exclusions for MS SharePoint 2010

AntiVirus exclusions for MS SharePoint 2010


Foundation and SharePoint Server

Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions

If you do not want to exclude the whole "Web Server Extensions" folder from antivirus scanning, you can exclude only the following two folders:

Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Logs
Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Data\Applications

Drive:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files
Drive: \Users\service account\AppData\Local\Temp\WebTempDir

Drive\ProgramData\Microsoft\SharePoint\
Drive\Users\the account that the search service is running as\AppData\Local\Temp

Note The search account creates a folder in the "gthrsvc_spsearch4 Temp" folder to which it periodically needs to write.
Drive:\WINDOWS\system32\LogFiles
On 64 Bit Windows 2008 Server with 64 Bit Product, the location is Drive:\Windows\Syswow64\LogFiles

Note If you use a specific account for SharePoint services or application pools identities, you may also have to exclude the following folders:
Drive:\Users\ServiceAccount\AppData\Local\Temp
Drive:\Users\Default\AppData\Local\Temp



SharePoint Server

You may have to configure the antivirus software to exclude the "Drive:\Program Files\Microsoft Office Servers" folder from antivirus scanning for SharePoint Server 2010. If you do not want to exclude the whole "Microsoft Office Servers" folder from antivirus scanning, you can exclude only the following folders: Drive:\Program Files\Microsoft Office Servers\14.0\Data.

(This folder is used for the indexing process. If the Index files are configured to reside in a different folder, you also have to exclude that location.)
Drive:\Program Files\Microsoft Office Servers\14.0\Logs
Drive:\Program Files\Microsoft Office Servers\14.0\Bin
Drive:\Program Files\Microsoft Office Servers\14.0\Synchronization Service
Any location you chose to store Disk-based BLOB cache. For example: C:\blobcache For more information on BLOB cache, see: http://technet.microsoft.com/en-us/library/ee424404.aspx#Section1



Full list of exclusions for other SharePoint version here : http://support.microsoft.com/kb/952167