Tuesday, 13 November 2007

Sam doing well now...

My son (Sam) is back home and doing quite well now.

 

My wife and I would like to thank everyone who sent messages and prayers, the support we have received has been fantastic, thank you all.

 

On Friday (19th) Sam started to feel rough, high temperature, crying, loose stools etc. Sam had never been this bad before so Sarah spoke with NHS Direct who advised he had some Calpol and plenty of fluids, if he got any worse we should take him to the GP. We had a rough night on Friday and while changing a nappy early Saturday morning I noticed a rash. The glass test showed the rash remained, so, we took Sam over to the NHS walk-in centre at Loughborough where the Doctor took one look and immediately prescribed a Penicillin shot which he administered seconds later. He advised us to get Sam to A&E at Leicester Royal Infirmary and to not worry about speed (he said he would assist me if anything went to court).

 

We arrived at A&E and found we were expected, they had already got a cubicle set up and had the staff ready to help Sam. He had some IV's put in and was plugged into an array of machines.

 

He continued to deteriorate and was admitted to the children's Intensive Care Unit. We were able to see him a few hours later. He was fully sedated and had been paralysed to prevent him moving. The doctors explained that he had a variant of Meningitis and that a blood test would reveal which one (although it didn't matter which at this stage as the approach was the same).

 

Overnight Sam had suffered a collapsed lung and was really struggling.

 

He started to respond the treatment and was stabilised around midday Sunday.

 

Sam started improving and was steadily getting better, he was extubated on Tuesday evening, by Wednesday we were on a high dependency ward and out of the ICU. The nurses were absolutely amazing, can't praise them enough.

 

We were sent home "weekend leave" (I don't quite follow this but I wasn't going to not bring Sam home!). We were back on the ward Monday and Sam was discharged later that day.

 

He has been improving slowly since and is a long way back to being his old self...

 

There are several tests to be done and depending on how they go the doctors may treat Sam as an out patient or he may have to go back into hospital for anything from a couple of days to several weeks. There is the risk of brain damage, hearing damage and several other things, but Sam seems to be alert and isn't showing any significant memory or balance issues. He's just tired and a bit uncoordinated, he seems to have regressed a few weeks in his development but this is expected in an infant (so we are told). Hopefully he'll pass whatever tests are to follow in the coming weeks.

 

The tissue damage Sam has suffered (not as bad as images you'll see online if you research this illness) is being treated with a cream and oral medicine, he may have a few scars that may never fully repair, but this is a minor thing in comparison to what could have happened.

 

The doctors suspect he has had Meningococcal Septicaemia (type B caused by Neisseria Meningitidis bacterium), this may never be confirmed as the heavy weight anti-biotics Sam was given will have probably prevented the blood taken from growing spores that prove things one way or the other.

 

In many respects we have been very lucky. Sam isn’t showing any signs of long term harm and is almost back to his normal cheeky self. If it wasn’t for a couple of patches of skin damage and his bald patches you’d be hard pressed to know he was very ill only 2 weeks ago.

 

 

 

I was scheduled to be speaking at a SUGUK event on the 29th, but this was binned (for obvious reasons), thanks go out to the SUGUK community (esp to Steve and Andrew) for their support and understanding.

Sunday, 2 September 2007

MOSS Site Usage Report error (and crash!)

I have seen problems with site usage reporting on three client sites now, so thought a blog entry was warranted...

 

The symptom of the problem is that when trying to access the site usage reporting in MOSS the user (who does have access) is prompted to authenticate, upon failing to authenticate the worker process falls over.

 

The resolution is the application of a non-public hotfix to ASP.net 2.0: http://support.microsoft.com/kb/913384

Finding sites in WSS2.0 content DB's

Ever had the problem where you have multiple content databases for a given web application in WSS and need to find which one has the site you’re after?

Probably not, I’d only had the odd one until recently, so I wrote the following script to help out…

This works only where you have single SQL server with content databases, if you have content databases across multiple SQL servers you’ll need to modify this script slightly…

Font is quite small to fit it all on one screen!! - Simply copy-paste into your favourite script editor (I like PrimalScript)...

** Start Script **

'declare
Dim debugmode
' read CommandLine args into vars
' no validation here so they must all be complete
For Each oArg In WScript.Arguments
  sSwitch = LCase(Left(oArg,3))
  sValue = Right(oArg,Len(oArg)-3)
  Select Case sSwitch
    Case "-x:"
        Debugoption = sValue 
    Case "-y:"
        SQLServer = sValue
    Case "-z:"
        ConfigDB = sValue
    Case "-s:"
        SiteSearch = SValue
  End Select
Next
'Debug Option
'error and bomb out if not set
If Debugoption = "debugon" Then
        debugmode = 1
        MsgBox "Debugging activated!", vbOKOnly Or vbExclamation
        MsgBox "SQLServer = " & SQLServer, vbOKOnly Or vbExclamation
        MsgBox "ConfigDB = " & ConfigDB, vbOKOnly Or vbExclamation
        MsgBox "SiteSearch = " & SiteSearch, vbOKOnly Or vbExclamation
Elseif Debugoption = "debugoff" Then
        debugmode = 0
Else
        MsgBox "Debugoption not specified, please set using:" & (Chr(13)) & "'sitebackup.vbs -x:debugon' for ON" & (Chr(13)) & "'sitebackup.vbs -x:debugoff' for OFF" & (Chr(13)) & "this utility will do nothing without the correct command line arguments!"  & (Chr(13)) & (Chr(13)) & "Matt is a lazy coder!", vbOKOnly Or vbCritical, "BIG FAT ERROR"
        WScript.Quit
End if
If SQLServer = "" Then
        'error out
        MsgBox "SQL Server not specified, please set using:" & (Chr(13)) & "'sitebackup.vbs -y:SERVERNAME'" & (Chr(13)) & "This utility will do nothing without the correct command line arguments!"  & (Chr(13)) & (Chr(13)) & "Matt is a lazy coder!", vbOKOnly Or vbCritical, "BIG FAT ERROR"
        WScript.Quit
End If
If ConfigDB = "" Then
        'error
        MsgBox "ConfigDB not specified, please set using:" & (Chr(13)) & "'sitebackup.vbs -z:DATABASENAME'" & (Chr(13)) & "This utility will do nothing without the correct command line arguments!"  & (Chr(13)) & (Chr(13)) & "Matt is a lazy coder!", vbOKOnly Or vbCritical, "BIG FAT ERROR"
        WScript.Quit
End If
If SiteSearch = "" Then
        'error
        MsgBox "Site URL not specified, please set using:" & (Chr(13)) & "'sitebackup.vbs -s:http://server/sites/site'" & (Chr(13)) & "This utility will do nothing without the correct command line arguments!"  & (Chr(13)) & (Chr(13)) & "Matt is a lazy coder!", vbOKOnly Or vbCritical, "BIG FAT ERROR"
        WScript.Quit
End If
filedatestamp = "Y" & year(now()) & "-M" & month(now()) & "-D" & day(now()) & "-HH" & hour(now()) & "-MM" & minute(now())
' SET CONSTS
baseDir = BakDrive & BakDir
SQLConString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=" & ConfigDB & ";Data Source=" & SQLServer
If Debugmode = 1 Then
        'MsgBox "baseDir = " & baseDir & (Chr(13)), vbOKOnly Or vbExclamation
        MsgBox "sql con string = " & SQLConString & (Chr(13)), vbOKOnly Or vbExclamation
End If
' CONNECT TO DB
Dim WSSCon
Set WSSCon = CreateObject("ADODB.Connection")
WSSCon.Open SQLConString
'create record set
set rsWSSDB = CreateObject("ADODB.recordset")
WSSDBsql="select Name from DATABASES order by Name"
rsWSSDB.open WSSDBsql, SQLConString
'loop through each contant DB
Dim NOval
Dim YESval
NOval = 0
YESval = 0
while NOT rsWSSDB.EOF
        set WSSSiteRS = CreateObject("ADODB.recordset")
        WSSSiteCon = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=" & rsWSSDB("Name") & ";Data Source=" & SQLSERVER
        'WSSSitessql="select fullUrl from SITES WHERE FullURL = '" & SiteSearch & "' order by fullUrl"
        'WSSSiteRS.Open WSSSitessql, WSSSiteCon
        'count records
        If Debugmode = 1 Then           
                MsgBox "WSSSiteCon = " & WSSSiteCon & (Chr(13)), vbOKOnly Or vbExclamation
        End If
        set cNumWSS = CreateObject("ADODB.recordset")
        NumWSSsql="select count(*) as TotTeamSites from SITES WHERE FullURL = '" & SiteSearch & "'"
        If Debugmode = 1 Then           
                MsgBox "Couting Query= " & NumWSSsql & (Chr(13)), vbOKOnly Or vbExclamation
        End If
        cNumWSS.open NumWSSsql, WSSSiteCon
        If Debugmode = 1 Then
                MsgBox "number of sites found = " & cNumWSS("TotTeamSites") & (Chr(13)), vbOKOnly Or vbExclamation
        End If
        If cNumWSS("TotTeamSites") = 0 Then
                NOval = (NOval + 1)
        End If
        If cNumWSS("TotTeamSites") >0 Then
                YESval = (YESval + 1)
                MsgBox "I found it!!" & (Chr(13)) & "It's in: " & rsWSSDB("Name") & (Chr(13)), vbOKOnly Or vbExclamation
        End If
rsWSSDB.MoveNext
wend
If YESVal = 0 Then
        MsgBox "I didn't find it!!" & (Chr(13)) & "I checked " & NOVal & " content databases" & (Chr(13)) & "You searched for: " & SiteSearch & (Chr(13)) & "Did you remember the trailing backslash?", vbOKOnly Or vbExclamation
End If
WSSCon.Close
cNumWSS.close 


** End Script **



 



Call the script from a shortcut or command line, like:



 



C:\path\script.vbs -x:debugon -y:MYSERVER -z:MyConfigDB -s:http://server/sites/sitename/



 



You must include the trailing backslash!

Friday, 3 August 2007

Starting Timer Jobs manually & Recycle Bin

I have been unable to find a way of starting (non-admin) timer jobs manually; however, you can change the default schedules.

 

I wanted to do this to test document deletions and prove the point to a client. For example, the job that runs against the recycle bin(s) and deletes expired items is called "job-recycle-bin-cleanup", this has a default value of "daily between 22:00:00 and 06:00:00" - you can find this information using STSADM:

 

STSADM -o getproperty -propertyname job-recycle-bin-cleanup -url http://server/

You can then change it to run at a more convenient time:

 

STSADM -o setproperty -propertyname job-recycle-bin-cleanup -propertyvalue "daily between 13:55:00 and 13:58:00" -url http://server/

Or (to update the job to run hourly):

 

STSADM -o setproperty -propertyname job-recycle-bin-cleanup -propertyvalue "hourly between 05 and 06" -url http://server/

The job will then run in the window specified... This saves waiting! You can update this as often as you need... Just don’t forget to change it back to the default (or other appropriate) setting!

 

It is worth noting that the first stage bin storage contributes towards your site size for quota purposes, the second stage % of quota is on top of the quota, so, if you had a 100MB quota and a site with 50MB in the site and 25MB in the (first stage) bin you have used 75MB of your 100MB. If you set a second stage quota at 20% you have an additional 20MB of storage (in addition to the 100MB quota) and therefore need to provision 120MB of storage for capacity planning back-end data storage for your site collections.

 

It is also worth noting that the first stage recycle bin does not delete/move items into the second stage if the retention period triggers the deletion (ie; the timer job deletes the document) this only occurs where a user deletes from the first stage bin. I think most SharePoint users would prefer that items deleted from the first stage bin did go into the second stage bin when expired/deleted automatically and that a retention period could be set (separate to the first stage retention period) here in combination with the % of the quota.

 

Furthermore, the day retention is applicable to both bins, so a document deleted out of the first stage bin by a user will have the same day retention applied (unless the quote limit is reached!) in the second stage bin... (if you see what I mean)

 

More RecycleBin info:

 

http://www.mindsharpblogs.com/ben/archive/2007/02/11/1562.aspx

http://www.mindsharpblogs.com/bill/archive/2006/06/26/1145.aspx

http://office.microsoft.com/en-us/sharepointtechnology/HA100214341033.aspx?pid=CH100267001033

Sunday, 1 July 2007

Saturday, 2 June 2007

Finding SharePoint Versions

Found this useful blog post from Penny at Mindsharp while trying to find
which SP a version number related to...
http://mindsharpblogs.com/penny/articles/481.aspx

Useful for future reference, hopefully Penny will keep it updated.

Monday, 23 April 2007

Tuesday, 13 March 2007

Attaching Content DB's in MOSS/WSS3

After completing your capacity planning exercise prior to deploying MOSS/WSS3 you will have the number of content DB's you are going to start with (a very different proposition to working out the number of content DB's you'll end up with!). For the sake of the article let's say the number came out at 22 per WebApp.

 

So, you can either create 21 DB's manually (remember, you already have one) and then assign them manually, which will be about 90 seconds to create each DB in SQL, plus around 60 seconds to attach each DB to the WebApp, so it will take (1+1.5)*21 for each WebApp, totalling 52.5 minutes of repetitive boredom (unless you have a placement student or intern to hand!)...

 

So, partly because I'm lazy, partly because a hate repetitive tasks, but mainly because I like scripting, I thought I'd write some scripts to do all this for me...


The SQL script

This script will create you the additional 21 content DB's, it assumes your first content DB already exists and is called SharePoint_ContentDB_01, simply copy-paste into SQL Query Analyzer... (Thanks to Steve Maxwell for this)

 

USE [master]
GO
DECLARE
@DBName nVARCHAR(255)
, @Number nVARCHAR(4)
, @DataFileName nVARCHAR(255)
, @LogFileName nVARCHAR(255)
, @DataFile nVARCHAR(255)
, @LogFile nVARCHAR(255)
, @SQL nVARCHAR(MAX)
, @ServiceIdentity nVARCHAR(255)
, @AppPoolIdentity nVARCHAR(255)
SELECT
@Number = '02'
/* set these to the correct values for you environment */
, @ServiceIdentity = '<SERVICE Account>'
, @AppPoolIdentity = '<AppPool Account>'
WHILE @Number <= 22
BEGIN
SET @DBName = 'SharePoint_ContentDB_'+@Number
SELECT
@DataFileName = @DBName
, @LogFileName = @DBName + '_log'
/* set the following paths to the correct locations in your environment */
, @DataFile = 'M:\Microsoft SQL Server\MSSQL.1\MSSQL\Data\' + @DBName + '.mdf'
, @LogFile = 'L:\Microsoft SQL Server\MSSQL.1\MSSQL\Data\' + @DBName + '_log.LDF'
SET @SQL = 'CREATE DATABASE ' + @DBName + '
ON PRIMARY 
(NAME = ''' + @DBName + '''
, FILENAME = ''' + @DataFile + '''
/*set the following pre-size and growth values to whatever suits your needs - this helps ensure data file are contiguous*/
, SIZE = 10240000KB
, MAXSIZE = UNLIMITED
, FILEGROWTH = 5120000KB)
LOG ON 
(NAME = ''' + @LogFileName + '''
, FILENAME = ''' + @LogFile + '''
/*set the following pre-size and growth values to whatever suits your needs - this helps ensure log file are contiguous*/
, SIZE = 2048000KB
, MAXSIZE = UNLIMITED
, FILEGROWTH = 1024000KB)
COLLATE Latin1_General_CI_AS_KS_WS'
EXEC (@SQL)
EXEC dbo.sp_dbcmptlevel @dbname=@DBName, @new_cmptlevel=90
EXEC [SharePoint_ContentDB_01].[dbo].[sp_fulltext_database] @action = 'enable'
SET @SQL = 'USE '+@DBName+';EXEC sp_changedbowner '''+@ServiceIdentity+''''
EXEC (@SQL)
SET @SQL = 'USE '+@DBName+';CREATE USER ['+@AppPoolIdentity+'] FOR LOGIN ['+@AppPoolIdentity+']'
EXEC (@SQL)
SET @SQL = 'USE '+@DBName+';EXEC sp_addrolemember ''db_owner'', '''+@AppPoolIdentity+''''
EXEC (@SQL)
SET @Number = @Number + 1
SET @Number = RIGHT('00' + @Number,2)
END 





The VB



Place this script in C:\Add_ContentDB_Script\

It will create a batch file called AddDBAContentDB.bat which must be run in order to attach the content DB’s to the web application. The batch file must NOT exist already as no checks to find an existing file are performed.



 



The variables



The script must be changed to suit the environment and the following variables edited:



 



SQLServ = SQL Server/Instance where the DB’s have been created (eg; MOSSSQLCLU01)


DBnameconv = The naming convention used, without number. (eg; SharePoint_contentDB_)


DBnumberEnd = The number of DB’s plus one (if 22 DB’s have been created use 23)


DBnumberStart = The first DB not already attached to the MOSS/WSS site collection (eg; 02)


SiteURL = The NLB URL of the MOSS/WSS WebApp to attach the DB’s (eg; http://web.archive.org/web/20070319224126/http://intranet.domain.com/)


SiteLimit = The maximum number of sites allowed in the DB


SiteWarn = The number at which a warning is generated



 



The Script



dim SQLServ
Dim DBnameconv
Dim DBnumberEnd
Dim DBnumberStart
Dim SiteURL
Dim SiteLimit, SiteWarn
'set the parameters used here
SQLServ = "MOSSSQLCLU01"
DBnameconv = "SharePoint_contentDB_"
DBnumberEnd = 23
DBnumberStart = 2
SiteURL = "http://intranet.domain.com"
SiteLimit = 50
SiteWarn = 40
Dim ObjFile, objExp
Dim strPath, strFile, strFilePath, strMyFile
' ste the path to use
strPath = "C:\Add_ContentDB_Script\"
strFile = "AddDBAContentDB.bat"
strFilePath = strPath & strFile
' FSO creates the object called - ObjFile
' no validation here = file cannot already exist!!!
Set objFile = CreateObject("Scripting.FileSystemObject")
Set strMyFile = objFile.CreateTextFile(strFilePath, True)
strMyFile.WriteLine("cd\")
' write the header
strMyFile.WriteLine("cd ""Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\""")
DBnumberCurrent = DBnumberStart
'start the loop
do while DBnumberCurrent < DBnumberEnd
' .WriteLine to add data to each line in the file
if DBnumberCurrent < 10 then
strmyFile.WriteLine("STSADM -o addcontentdb -url " & SiteURL & " -databasename " & DBnameconv & "0" & DBnumberCurrent & " -databaseserver " & SQLServ & " -sitewarning " & SiteWarn & " -sitemax " & SiteLimit)
Else
strMyFile.WriteLine("STSADM -o addcontentdb -url " & SiteURL & " -databasename " & DBnameconv & DBnumberCurrent & " -databaseserver " & SQLServ & " -sitewarning " & SiteWarn & " -sitemax " & SiteLimit)
End If
DBnumberCurrent = (DBnumberCurrent + 1)
Loop
'done!
strMyFile.Close
WScript.Quit






The batch file


The file created can then be run (you'll need to be a farm admin to do this bit)...



 



You'll then have your 22 content DB's attached to your WebApp. Happy Days!