Wednesday, September 19, 2012

Force an update of Web Analytics


With the service Web Analytics in SharePoint 2010 you can either see statistics reports in Central Administration or retreive information from it to display on your pages. There is one big drawback. The statistics are updated only once a day, and this cannot be changed anywhere in Central Administration. To check what the current settings of your Web Analytics service application, use the following Power Shell command:

PS> Get-SpWebAnalyticsServiceApplication -identity "web analytics service application"

By default the start time of the report consolidation is "Daily at 02:00". It is possible to change the time when the update is made with the following Power Shell command:

PS> Set-SpWebAnalyticsServiceApplication -identity "web analytics service application" -ReportConsolidationStartTime 12

This will change the start time of the report consolidation to "Daily at 12:00". Note that the number, 12 in my example, must be an integer value between 1 and 23. I haven't tried this myself yet, but this should mean that in theory you could write a Power Shell script, or something, that runs every half hour and pushes the start time forward one hour. This should force the report consolidation to run every hour instead of once each day. But to get up to one hour old statistics is usually not good enough, but it's the best you can do with the Web Analytics service. Too bad.

Yet another day in SharePoint paradise...

Profile import in 2010 cannot filter on AD-groups

The other day I was doing some configuring on a brand new SharePoint 2010 farm at a customer. My task was to configure the profile import just as their old SharePoint 2007 farm was configured. Easy peasy...not.

I started the user profile synchronization service, created a new connection to their AD, made the first synchronization and got no profiles at all. Then I remembered that the profile synchronization service account  must have replication directory changes permission. This sounds worse than it actually is and is fixed by following this TechNet article, http://technet.microsoft.com/en-us/library/hh296982.aspx#RDCdomain. After that the profile database was populated correctly.

Then I just had to create a filter for a handful of AD-groups. In SharePoint 2007 this was done by adding a LDAP-filter to the connection. In the filter you define what should be included/excluded in the synchronization. In SharePoint 2010 this is no longer a valid option. Instead you define one or more exclusion filters. First of all, to limit the filter to just being an exclusion filter is really stupid. The other setback is that it's not possible to filter on AD-groups any more, just AD-parameters! I found this official blog post to confirm this, http://blogs.msdn.com/b/spses/archive/2011/05/31/sharepoint-2010-profile-sync-inability-to-import-users-based-on-group-membership.aspx.

The story ends with a custom profile database clean-up job, which is a story in itself, and a slightly unhappy customer. I find some comfort in the fact that I'm not alone, http://donalconlon.wordpress.com/2011/04/26/fun-with-filters-user-profile-synchronization-somebody-shoot-me-now/.

Yet another day in SharePoint paradise...

WSS_UsageApplication proxy stopped

All of a sudden the web analytics reports on one of my development servers was not updating properly. I followed this http://technet.microsoft.com/en-us/library/ff453926.aspx but could not find anything wrong. Then I noticed that the service application proxy to the usage application was in status "Stopped". Since there is no way of restarting application proxies in Central Administration my first thought was to remove Web Analytics from the farm and recreate it again. Luckily I found this blog post before I started tearing things down, http://tristanwatkins.com/index.php/fixing-the-usage-and-health-data-collection-sa/. I ran the following Power Shell commands and after that the application proxy was in status "Started" again:

PS> $sap = Get-SPServiceApplicationProxy | where-object {$_.TypeName -eq “Usage and Health Data Collection Proxy”}
PS> $sap.Provision()

Yet another day in SharePoint paradise...