Wednesday, July 15, 2009

STSADM your Best friend...


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

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

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"


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

Export: Stsadm operation
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

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

There you can start manage permissions, groups and users:




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

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