SharePoint 2010 State Service Database
I recently found a small bug in the SharePoint 2010 PowerShell comlets for creating the state service database using “New-SPStateServiceDatabase”. You will receive the rather unhelpful error message “Operation is not valid due to the current state of the object”. I believe this is a generic WCF error as that’s all I was able to find when researching what may cause the problem. However, it later transpired that this was because I was trying to use a database alias (or potentially database server) which SharePoint isn’t currently aware of, as using the alias (or database server) that was used for the initial farm setup didn’t result in the same issue.
New favorite PowerShell command
Everytime I have to open log file I always wished it would update on its own so I didn’t have to close it and open it again. I know applications like visual studio notify you when a file updates but its usually not a good idea to install it on the production machine and across the network access can be painful. In comes PowerShell to save the day… And its install on pretty much all modern windows servers these days as standard.
PowerShell Script: Get-SPHealthScore
The Get-SPHealthScore power shell commandlet is a simple commandlet that will query the value of the health score for any SharePoint 2010 URL (providing the header hasn’t been removed for security reasons which I will discuss in a later post).
function Get-SPHealthScore([string]$url) { $request = [System.Net.WebRequest]::Create($url) $request.Method = "HEAD" $response = $request.GetResponse() if(($score = $response.Headers.Get("X-SharePointHealthScore")) -ne$null) { Write-Host $score } else { Write-Host 'The specified URL is not a SharePoint 2010 site or does not contain a health score' } } If you’re not familiar with the health score header, it is added to any SharePoint response for use by Microsoft Office applications in order for them to reduce their request rate if the server is particularly busy.
SharePoint 2010: Change the name of the Administration Content Database
One of the things that annoys me about SharePoint is the way in which it automatically names the databases, even when you don’t use the wizard (don’t get me started on that). One thing you can’t do when you run the configuration wizard to create a brand new farm is to specify the database name for the central administration database. Instead you end up with something like “Content_Admin_abcdefg0093857378383”, if this annoys you as much as it does me then there is a solution.