Automating the install of the Application Templates for SharePoint

by Kindler Chase 20. January 2008 00:00

As I was manually installing the Fab 40 Application templates and sites for SharePoint 2007 in my development environment, I did what most lazy developers do: What could I do to automate the process of installing all the templates? Then it hit me. Why not just iterate through the file system and call the stsadm.exe command line for each file.

And as the sharing SharePoint developer I am, I decided to post my installation scripts for all other lazy developers.

Automating the installation of the WSP and STP templates

To install the WSP and STP templates to your SharePoint site:

  1. Unzip the templates to either a directory on your server or a file share you can access from your server.
  2. Save the following scripts as a .bat file to the same directory you unzipped the templates into.
  3. Simply double click each .bat file and watch the automated install which should take no more than a couple of minutes for each .bat file.

The following code snippets can be downloaded at the bottom of this post.

install-wsp-templates.bat

The following will install the .WSP templates:

  • AbsenceVacationSchedule.wsp
  • ApplicationTemplateCore.wsp
  • BudgetingTrackingMultipleProjects.wsp
  • BugDatabase.wsp
  • CallCenter.wsp
  • ChangeRequest.wsp
  • ComplianceProcessSupport.wsp
  • ContactsManagement.wsp
  • DocumentLibraryReview.wsp
  • EventPlanning.wsp
  • ExpenseReimbursementApproval.wsp
  • HelpDesk.wsp
  • InventoryTracking.wsp
  • ITTeamWorkspace.wsp
  • JobRequisition.wsp
  • KnowledgeBase.wsp
  • LendingLibrary.wsp
  • PhysicalAssetTracking.wsp
  • ProjectTrackingWorkspace.wsp
  • RoomEquipmentReservations.wsp
  • SalesLeadPipeline.wsp 
   1:  :: Kindler Chase 2008-01-15 www.RareGrooveRider.com
   2:  :: Installation of all application templates
   3:  :: Be sure to run this script from the location the application templates reside.
   4:   
   5:   
   6:  @ECHO OFF
   7:   
   8:  ECHO This will install all the WSS 3.0 WSP Application templates.
   9:  ECHO.
  10:  ECHO Be sure this script resides in the same directory 
  11:  ECHO as the application templates!!!
  12:  ECHO.
  13:  PAUSE
  14:  CLS
  15:   
  16:  SET STS="C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\stsadm.exe"
  17:   
  18:  FOR %%G IN (*.wsp) DO (
  19:  ECHO %%G start
  20:  %STS% -o addsolution -filename %%G
  21:  %STS% -o deploysolution -name %%G -allowgacdeployment -immediate
  22:  ECHO %%G end
  23:  ECHO.
  24:  ECHO.
  25:  )
  26:   
  27:  ECHO Copying app bin content.
  28:  ECHO.
  29:   
  30:  %STS% -o copyappbincontent
  31:   
  32:  ECHO.
  33:  ECHO App bin content complete.
  34:  ECHO.
  35:  ECHO.
  36:  ECHO Executing jobs.
  37:  ECHO.
  38:   
  39:  %STS% -o execadmsvcjobs
  40:   
  41:  ECHO.
  42:  ECHO Jobs complete.
  43:  ECHO.
  44:  ECHO.
  45:  ECHO That's all folks!
  46:  ECHO.
  47:   
  48:  PAUSE
  49:   
  50:  EXIT

install-stp-tempaltes.bat

The following will install all the .STP templates:

  • BoardDirectors.stp
  • BusinessPerformance.stp
  • CaseManagement.stp
  • ClassroomManagement.stp
  • ClinicalTrial.stp
  • CompetitiveAnalysis.stp
  • DiscussionDatabase.stp
  • DisputedInvoice.stp
  • EmployeeActivities.stp
  • EmployeeBenefits.stp
  • EmployeeTraining.stp
  • EquityResearch.stp
  • ManufacturingProcess.stp
  • MarketingCampaign.stp
  • NewStoreOpening.stp
  • ProductPlanning.stp
  • RequestForProposal.stp
  • SportsLeague.stp
  • TeamWorkSite.stp
  • TimecardManagement.stp
   1:  :: Kindler Chase 2008-01-15 www.RareGrooveRider.com
   2:  :: Installation of all application templates
   3:  :: Be sure to run this script from the location the application templates reside.
   4:   
   5:   
   6:  @ECHO OFF
   7:   
   8:  ECHO This will install all the WSS 3.0 STP Application templates.
   9:  ECHO.
  10:  ECHO Be sure this script resides in the same directory 
  11:  ECHO as the application templates!!!
  12:  ECHO.
  13:  PAUSE
  14:  CLS
  15:   
  16:  SET STS="C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\stsadm.exe"
  17:   
  18:  FOR %%G IN (*.stp) DO (
  19:  ECHO %%G start
  20:  %STS% -o addtemplate -filename %%G -title %%G
  21:  ECHO %%G end
  22:  ECHO.
  23:  ECHO.
  24:  )
  25:   
  26:  ECHO.
  27:  ECHO Ready to reset IIS.
  28:  PAUSE
  29:   
  30:  iisreset -noforce
  31:   
  32:  ECHO.
  33:  ECHO.
  34:  ECHO That's all folks!
  35:  ECHO.
  36:   
  37:  PAUSE
  38:   
  39:  EXIT

You now have 40 new site templates to play with on your SharePoint site.

Enjoy!

install-wsp-templates.bat (934.00 bytes)

install-stp-templates.bat (733.00 bytes)

Comments

3/10/2008 1:29:14 PM #

nice tool! thank you

huy nguyen United States

3/10/2008 1:46:55 PM #

You're welcome, huy!

BTW, you can use the same scripts to install any .stp/.wsp templates by dropping the bat file(s) in the directory the templates reside.

Cheers!
::kindler::

Kindler Chase United States

3/24/2008 12:48:28 PM #

Gr8 stuff.. works like charm

productive and effificent use of time

Thanks agian.

Sameer United States

4/26/2008 10:34:24 PM #

Thanks - This was great - Very cool... I will let others know... Got any other cool sharepoint tools to share or sell... Let me know anytime...

TCowles United States

5/11/2008 2:29:39 AM #

hi, i would like to ask is this the one that able to deploy into the sharepoint server automatically (meaning once i upload the template into mysite, it will also be uploaded into central adminstration) or it only upload many templates into mysite without doing it manually.


thank you.

hihi Singapore

5/11/2008 2:38:52 AM #

Yes, the script will deploy the templates to your SharePoint server automatically. I would recommend that you first run this in your test environment to verify it works. And then, if it works as expected, do the same in your production environment.

Cheers!
::kindler::

Kindler Chase United States

5/11/2008 8:35:20 PM #

hi, thanks for your reply. i would try today. =)

hi Singapore

5/11/2008 8:53:28 PM #

do you know of any post that would deploy the custom template into the sharepoint server.

hi Singapore

5/12/2008 9:32:26 AM #

Lee,

I'm sorry, but I don't understand what you are asking. The script in the post does deploy the templates to the SharePoint server..

Cheers!
::kindler::

Kindler Chase United States

5/31/2008 7:09:58 PM #

Thanks so much for these batch files!  Makes my life as a new SP adopter much easier.

Jignesh Joshi United States

6/7/2008 9:15:27 AM #

I downloaded your batch files and used them.  They worked fine.  You have done a great job for the community. Keep it up.

Tariq Changgez

Tariq Changgez Saudi Arabia

6/19/2008 4:38:15 PM #

Very nice tool! thank you.

Pascal Falcy Switzerland

9/6/2008 9:15:26 AM #

Thaks a lot. Greate idea. It helps me a lot.

Md. Zakir Hossain

9/17/2008 11:52:22 AM #

Awesome

Matt United States

10/30/2008 4:49:37 PM #

"I did what most lazy developers do"

Geez, lazy guys have all the fun nowadays.

how can i become more lazy like you.

P.S. appreciate you membership
in the "sharing SharePoint developer" club.

salman Saudi Arabia

11/1/2008 12:15:59 PM #

@salman,

"how can i become more lazy like you."

By default you become a member just by using the scripts ;) How's that for lazy?

::k::

Kindler Chase United States

11/13/2008 10:48:44 PM #

Pingback from chris.workmotive.com

The Travels of a SharePoint Designer: The Realm of the Fantastic Templates | Christopher Crowe

chris.workmotive.com

12/19/2008 6:36:17 AM #

Fantastic job on creating the batch files.

Thank you

saved a morning

Peter

Peter Gordon United Kingdom

2/2/2009 3:21:30 PM #

New to SP so I ran the batch file and it completed. How do I see it and create a list from the template ?

Cheers, Belfast

belfastcelt Ireland

2/3/2009 2:19:32 PM #

Wonderful!

Mickey United States

2/9/2009 5:01:21 AM #

Pingback from benway.net

links for 2009-02-09 | benway.net

benway.net

4/2/2009 10:55:14 AM #

Thank you for sharing this script- saved lots of time and was so easy to install the 40 templates.  Great Job

Wayne Wallace United States

6/4/2009 6:51:35 AM #

great job worked first time thanks save me hours of work

ash South Africa

6/5/2009 10:57:57 PM #

was going to write myself a script to do this, but thought there must be someone else who has done it.

thanks very much!

Nat Australia

Kindler Chase

Kindler Chase
This is SharePoint's world. I'm only living in it.

Your host, on the right, with my better half, Sadi.