Geeks With Blogs

News invisible hit counter View My Stats
Technical Speaking

First Time Deployment in the Production Environment using Script | Move sites between Production and Development Environment | Content Deployment using STSADM

We can do SharePoint 2007 deployment from the Central Administration and using STSADM.exe but most of the administrator prefer to work using stsadm.exe command. It is necessary to remember the command and do the same steps every time. Most of them want to get a batch deployment script or something easier to do it using stsadm.exe command. This article will show how to make own customize deployment script bat file and simple way  to deploy it. You have to make package folder before going to following stepsater. Let’s see the steps first: 

1.     Copy Package i.e. Deploy Folder in to C: Drive

Open Command Prompt and go to C:\Deploy

2.     Run Export_Site.bat [Site URL i.e. http://[server1: port]/sites/test1]

     It will export the website in the following location C:\Deploy\

3.     Run Create_Site.bat [New Site URL]

i.e. C:\Deploy>Create_Site http://[server2: port]/sites/test1

To Create a new site as source site type in existing Web Application

4.     Run Import_Site.bat [New Site URL]

i.e. C:\Deploy>Import_Site http://[server2: port]/sites/test1

It will import the website from the following loc C:\Deploy\

  If you have some features has been deployed before in the source site such as custom web part or event receiver or list definition then you have to do the following steps before running import_site.bat

  1. Run for each deployment

C:\Deploy>[Folder Name]\setup -install -siteurl [New Site URL                   i.e. http://[server2: port]/sites/test1]

To Install and Deploy List Definition, Event Receiver

How to make Deploy Package and bat script file: 


@echo off
if not "%1"=="" goto ExportImport
echo **** put web site name for emample: "http://server:port/sites/areri"
goto end
echo ************* Determine the Location to stsadm.exe
if EXIST "%CommonProgramFiles%\Microsoft Shared\Web Server Extensions\12\bin\stsadm.exe"
set BinDir=%CommonProgramFiles%\Microsoft Shared\Web Server Extensions\12\bin
echo Determined that the location to stsadm is %BinDir%

@echo on
@echo ************* Backup the root site collection
"%BinDir%\stsadm.exe" -o export -url %1 -filename C:\Deploy\ -versions 4 -overwrite

@echo off


   Create Create_Site.bat --> change with the previous part

@echo on
@echo ************* Create a destination site (-lcid 1033 for en, -sitetemplate)
"%BinDir%\stsadm.exe" -o createsite -url %1 -ownerlogin %UserDomain%\%UserName%
-owneremail -lcid 1033 -sitetemplate STS

  Create Import_Site.bat --> change with the previous part

@echo on
@echo ************* Import into the new site
"%BinDir%\stsadm.exe" -o import -url %1 -filename C:\Deploy\


Put all in the Deploy Folder for simple deployment otherwise put others sub packages (web part, even receiver etc.) and that’s it


Posted on Tuesday, October 21, 2008 3:42 AM Sharepoint 2007 , ASP.Net 2.0 , Microsoft Office SharePoint Server 2007 | Back to top

Comments on this post: SharePoint 2007 simple Deployment script

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © MJ Ferdous | Powered by: