SharePoint: Script to Install All Application Templates
I referred to couple of posts to help you install WSS v3 application templates. If you followed those instructions to a tee, then you would have been successful in installing the application templates. However, installing 20 or 40 templates using that method made me cranky
Why not install all of them using a script? Well here it is (idea originated from Dustin Miller) which I used to first add the templates and then deploy them.
Note: Make sure Windows SharePoint Services Administration service is running.
Just include this in your script if you want
net start spadmin
Now extract all you Application Templates in a folder. For example c:wssv3WSS_Server_Admin_Templates
Create a batch file with this code (Place this in the same folder where you have the templates)
for %%f in (*.wsp) do “C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12BINstsadm.exe” -o addsolution -filename %%f
Run this.
Create another batch file with this code (Place this in the same folder where you have the templates)
for %%f in (*.wsp) do “C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12BINstsadm.exe” -o deploysolution -allowgacdeployment -immediate -name %%f
pause
I have added stop command for Windows SharePoint Services Administration service and also a pause. Just in case you want to see, if everything went well. Don’t worry. If there was any issue, you would see when the batch file is processing. Basically the deploy solution takes some time.
Done!
- Thanks, that is quite useful!...
- Hi Guys, Any one know how to push this out to multiple ma...
- Cheers mate. tried a bunch of stuff and this worked a treat ...
- .. ] is another nice source of information on this topic..]...
- I found easier way to do so. Tools-> Options-> Mail F...
- Yeah I was wondering how to sign up for the Windows Live Hot...
- Hello, I already have the image embedded into the html si...
- make sure you do all line breaks with shift + enter and b...
- after creating a sig with the logo you want, you can open MS...
- What if there is not signature folder, I'm doing this remote...



Andy Williams said,
Wrote on April 27, 2007 @ 12:22 am
Hi.
I seen to be as confused as everyone else. Where ever i look i see what you’ve written below.
for %%f in (*.wsp) do “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\stsadm.exe” -o addsolution -filename %%f
Run this.
Create another batch file with this code (Place this in the same folder where you have the templates)
for %%f in (*.wsp) do “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\stsadm.exe” -o deploysolution -allowgacdeployment -immediate -name %%f
No one seems to know what the “for %%f in (*.wsp)” means. What should i be putting at the -name %%f part at the end of the string ?
Regards
Andy Williams
l0rd said,
Wrote on June 18, 2007 @ 6:23 pm
Hi Andy!
The problem is with the quotation marks. I solved it by putting the stsadm.exe path to the system’s path enviroment variable. Working great. best regards
Alpesh said,
Wrote on June 19, 2007 @ 12:34 pm
l0RD, thanks for your inputs.
Andy you run this in a script and it refers to the files in the same location as the script. So your script should be in the same folder as the application templates. You don’t put individual filename, that is taken care of by the %%f bits.
So if you are looking to install the WSS 3.0 templates on your WSS 3.0 (side by side) - E-Bitz - SBS MVP the Official Blog of the SBS "Diva" said,
Wrote on June 29, 2007 @ 11:42 am
[...] http://alpesh.nakars.com/blog/wssv3-application-template-installation/ [...]
harry said,
Wrote on July 13, 2007 @ 1:44 pm
how is a script created?
Sam said,
Wrote on September 19, 2007 @ 12:16 am
I noticed if I copied and pasted the code above into a batch file the “” characters didnt work and the script failed.
All you have to do to get it to work is to delete the quotation marks and re-enter them
Tom said,
Wrote on November 25, 2007 @ 3:56 am
I am having trouble with this script as well.
It is executing the stsadm.exe command from the diretory that has the templates in it.
ie:
c:\wss_templates\c:\program files\common files\microsoft shared\web server extensions\12\bin\stsadm . . .
is not a recognized command
How can I change the directory within the batch file, so that it executes stsadm inside the correct directory?
Thanks for the help.
Nick said,
Wrote on January 20, 2008 @ 4:00 am
Basically you just make 2 batch files in the same folder that you extracted all the templates (.wsp files) to. I named them installtemplatesstep1.bat and installtemplatesstep2.bat.
Then when I copied the code, it imported some jacked up quotes so I had to open the .bat files and manually type in the quotes to fix the syntax issue.
Hancy said,
Wrote on January 29, 2008 @ 9:55 pm
I tried the script and I got the same error myself but try to revised the batch to this format:
for %%f in (*.wsp) do “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\stsadm.exe” -o addsolution -filename %%f
and…
for %%f in (*.wsp) do “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\stsadm.exe” -o deploysolution -allowgacdeployment -immediate -name %%f
adding ” (qoutation marks) made it work fine. It was a fine Batch file that need some tune up. Thanks alot.
Alpesh said,
Wrote on January 29, 2008 @ 10:41 pm
Thanks for sharing. Yes codes can go bonkers here.
Supergeek915 said,
Wrote on March 20, 2008 @ 7:51 am
Easier to read…
1. Right click on My Computer and choose Properties
2. Advanced tab, Environmental Variables
3. In the System variables section, scroll to Path, highlight it and choose Edit
4. In the Variable value box, go to the very end, put a semicolon, then paste in:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\
Note: There is no space between the semicolon and the path.
5. Click OK to close the windows
6. Save this as template1.bat:
for %%f in (*.wsp) do stsadm.exe -o addsolution -filename %%f
Note: Save this in the same folder as your WSP files
7. Save this as template2.bat:
for %%f in (*.wsp) do stsadm.exe -o deploysolution -allowgacdeployment -immediate -name %%f
Note: Save this in the same folder as your WSP files
8. You can either run this in the Windows GUI or via Command Prompt as I prefer.
Done.
Alpesh Nakar Blogs on SharePoint, Microsoft and that's IT! said,
Wrote on July 11, 2008 @ 6:58 pm
[...] I have written a script here to do all of this at one [...]
Eddie said,
Wrote on August 8, 2008 @ 7:57 am
Super tip. Worked perfectly!
Donna said,
Wrote on November 4, 2008 @ 6:30 am
Followed the instructions written by the person below and it worked perfectly! THANKS!!!!
Supergeek915 said,
Wrote on March 20, 2008 @ 7:51 am
Easier to read…
The Travels of a SharePoint Designer: The Realm of the Fantastic Templates | Christopher Crowe said,
Wrote on November 14, 2008 @ 1:48 pm
[...] script. There are a couple of things to note about this script. First off, original credit goes to Alpesh Nakar and Kindler Chase. Each had great scripts, however I customized them a bit more to meet my needs. [...]
Brandon said,
Wrote on January 8, 2009 @ 3:53 am
Awesome. Its such a simple script but it takes so many keystrokes out of my carpal tunnel. Thanks a bunch man!
application templates wss 3.0 - not working | keyongtech said,
Wrote on January 19, 2009 @ 2:36 am
[...] application templates wss 3.0 – not working Hi Todd, You might want to try this script http://alpesh.nakars.com/blog/wssv3-…-installation/ — Alpesh Nakar blog: http://alpesh.nakars.com "todd5574" wrote: > Hi, > I [...]
Amol said,
Wrote on March 29, 2009 @ 12:16 am
Hello alpesh,
could you please mentioned how to deploy role based templates? is there any standerd method for this or any documentation?
Best Regards,
Amol
Gautam Bhatt said,
Wrote on July 9, 2009 @ 1:20 pm
Thanks Alpeshbhai