"Fab40" Application Templates for Windows SharePoint Services 3.0 install script
I followed the MOSS 2007 course last week and one of the exercises was to install additional application templates. Microsoft offers a set of 40 additional application templates on their website, which are not included in the standard installation: http://www.microsoft.com/technet/windowsserver/sharepoint/wssapps/templates/default.mspx
I was a little annoyed to see that Microsoft did not include a proper setup program or script for this set. There were only two simple readme files that stated a few commands that should be repeated for all 40 templates. I didn't plan to follow the execise until I noticed that fellow students where having trouble with the installation and I wanted to see if I could help them out.
It turned out that the a cut-and-paste from the readme file would result in a incorrect command, because the hypen (for the parameters) in the readme file are in fact figure-dashes and need to be replaced. That being solved, I noticed that people where starting to copy-and-paste the commands and replacing them with the numerous application tempate names. Hey, c'mon, what about a for loop? So for all people that have forgotten, or never learned, how to do a for loop in a command-line script:
set cmmand="C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12BINstsadm.exe"
%cmmand% -o addsolution -filename ApplicationTemplateCore.wsp
%cmmand% -o deploysolution -name ApplicationTemplateCore.wsp -allowgacdeployment -local
%cmmand% -o copyappbincontent
for /F %%i in ('dir /b *.wsp') do %cmmand% -o addsolution -filename %%i
for /F %%i in ('dir /b *.wsp') do %cmmand% -o deploysolution -name %%i -allowgacdeployment -local