Wednesday, July 15, 2009

STSADM your Best friend...

Yes,

Stsadm commands OOB is a excelent tool to manage, create and change structure of your sharepoint site, in a very easy way.
Every Administrator of Sharepoint need to know the real potential of this administration commands when are configuring our Sharepoint, or create custom develomp, but today will speak about administration site real case.

With this command we can create a sharepoint site, with all rules without using a click, just running a simple batch file.

One of the principal problem we can find, working with final client already with sharepoint on production.

Company have install default site and work directly on that site with the following context:
One site collection, one Database Content with 200GB, and a lot of sub-sites.
There are all the departament, and business core, They want, and need to move some sub-site to diferent places.
All customizations was on that Sharepoint site.

Problems.... lots, "Perfomance", Backup, manage permission, can be all nigth....

Well, Normaly recomend reconsider change the architecture to multiple site collections with diferents databases, "client already have multiple FARMS".
Plan for software boundaries
http://technet.microsoft.com/en-us/library/cc262787.aspx

First, on old Sharepoint site we need to identify wich sub-sites we want to move, write to paper or other document, Microsoft already have a lot of worksheets to support us.

Planning worksheets for Office SharePoint Server 2007
http://technet.microsoft.com/en-us/library/cc262451.aspx

Using this documents, we can define how will be our future Sharepoint Structure, and start to define the Path to access.

Define the name and path we need to create the managed Path

stsadm" -o addpath -url http://[newsite]/HumanResources -type Explicit
stsadm" -o addpath -url http://[newsite]/Financial -type Explicit
stsadm" -o addpath -url http://[newsite]/Operations -type Explicit

After create the managed Path we can create our site collection and we can associate diferente database for each one "Site collection"

stsadm -o createsiteinnewdb -url http://[newsite]/HumanResources -owneremail [Email] -ownerlogin [Domain\user]-sitetemplate [Site Template] -title [title] -databaseserver [Database server name] -databasename [Database name "wss_content_HumanResources"]

....."The same on the other new site collections"

Createsiteinnewdb
http://technet.microsoft.com/en-us/library/cc262407.aspx

After creating Site collection we can star removing Block of data from old Sharepoint site we want to migrate.

Export: Stsadm operation
http://technet.microsoft.com/en-us/library/cc262759.aspx
stsadm -o export -url http://[oldsite]/HumanResources -filename

After your remove the block of site just import to your new site collection with diferent Databases.
Import: Stsadm operation
http://technet.microsoft.com/en-us/library/cc261866.aspx

stsadm -o export -url http://[newsite]/HumanResources -filename

There you can start manage permissions, groups and users:

Creategroup
http://technet.microsoft.com/en-us/library/cc263302.aspx

Adduser
http://technet.microsoft.com/en-us/library/cc262627.aspx

UserRole
http://technet.microsoft.com/en-us/library/cc262083.aspx

After this all 200GB will be in diferent Databases the content will be lower, and we can manage Backup script to easly create Schedule Backups from our sharepoint Site collections.

STSadm -o backup -url http://[site]/HumanResources -filename

How To Use the AT Command to Schedule Tasks
http://support.microsoft.com/kb/313565

There we can create command line to make recycling on our Sharepoint site
%windir%\system32\cscript.exe c:\windows\system32\iisapp.vbs /a "[Web application Name]" /r