﻿<?xml version="1.0" encoding="UTF-8"?>
<!--RSS generated by Windows SharePoint Services V3 RSS Generator on 9/9/2010 11:17:38 AM-->
<?xml-stylesheet type="text/xsl" href="/Blog/_layouts/RssXslt.aspx?List=70640fe5-28d9-464f-b1c9-91e07c8f7e47" version="1.0"?>
<rss version="2.0">
  <channel>
    <title>Weblog Ton Stegeman [MVP]: Posts</title>
    <link>http://www.tonstegeman.com/Blog/Lists/Posts/AllPosts.aspx</link>
    <description>RSS feed for the Posts list.</description>
    <lastBuildDate>Thu, 09 Sep 2010 18:17:38 GMT</lastBuildDate>
    <generator>Windows SharePoint Services V3 RSS Generator</generator>
    <ttl>60</ttl>
    <image>
      <title>Weblog Ton Stegeman [MVP]: Posts</title>
      <url>/Blog/_layouts/images/homepage.gif</url>
      <link>http://www.tonstegeman.com/Blog/Lists/Posts/AllPosts.aspx</link>
    </image>
    <item>
      <title>MOSS Custom policies part 3 - implementing the custom policy</title>
      <link>http://www.tonstegeman.com/Blog/Lists/Posts/ViewPost.aspx?ID=24</link>
      <description><![CDATA[<div><b>Body:</b> <div class=ExternalClass29AF5284DC3C44C89F7DA7B2836C513B>
<p>This is the 3rd and last part in a small series on how to create a custom information management policy for SharePoint 2007. 
<p>In <a href="/Blog/Lists/Posts/Post.aspx?ID=22">part 1</a> the policy was introduced and we created the policy feature and created the setup control that allows our users to configure the policy.<br><a href="/Blog/Lists/Posts/Post.aspx?ID=23">Part 2</a> shows how to create the handler that actually does some work and submits a document to the records center<br>The final part will put it all together.
<p><strong>Step 1 – Registering the PolicyFeature</strong> 
<p>In the first part we implemented the IPolicyFeature interface, but it didn’t do anything. The first method we will implement is the <strong>Register</strong> method. This is called when the policy is assigned to a content type. This is the perfect place if you need to do some extra configuration. I will do 2 things here: 
<ul>
<li>Setup an event receiver for the content type. 
<li>Add an extra site column (and create if it doesn’t exist) to the content type.</li></ul>
<p>To setup an event receiver for the content type, we’ll add this code to the register method:<pre><div style="font-family:courier new;background:white;color:black;font-size:10pt"><pre style="margin:0px">    Assembly assembly = Assembly.GetExecutingAssembly();</pre><pre style="margin:0px">    SPEventReceiverDefinition eventReceiver = ct.EventReceivers.Add();</pre><pre style="margin:0px">    eventReceiver.Name = <span style="color:#a31515">&quot;Policy of Truth&quot;</span>;</pre><pre style="margin:0px">    eventReceiver.Type = SPEventReceiverType.ItemUpdated;</pre><pre style="margin:0px">    eventReceiver.SequenceNumber = 200;</pre><pre style="margin:0px">    eventReceiver.Assembly = assembly.FullName;</pre><pre style="margin:0px">    eventReceiver.Class = <span style="color:#a31515">&quot;TST.POC.PolicyFeatures.PolicyOfTruthHandler&quot;</span>;</pre><pre style="margin:0px">    eventReceiver.Update();</pre></div></pre>
<p>The event receiver itself will be implemented in one of the next steps. The code to setup the site column to the content type is added below. This will first check if a field with internalname “SentToTruthRepository” is available in the content type. If it is not it will check if this field is available as a site column. If the site column is not yet available, it will create it as a readonly site column. The value of this field will only be updated by our policy, and users should not be able to change it manually. This last bit adds the site column to the Content Type.<pre><div style="font-family:courier new;background:white;color:black;font-size:10pt"><pre style="margin:0px">    <span style="color:blue">string</span> fieldName = <span style="color:#a31515">&quot;SentToTruthRepository&quot;</span>;</pre><pre style="margin:0px">    <span style="color:green">// test if field is linked to content type</span></pre><pre style="margin:0px">    <span style="color:blue">foreach</span> (SPFieldLink link <span style="color:blue">in</span> contentType.FieldLinks)</pre><pre style="margin:0px">        <span style="color:blue">if</span> (link.Name == fieldName)</pre><pre style="margin:0px">            <span style="color:blue">return</span>;</pre><pre style="margin:0px">    SPField repositoryField = <span style="color:blue">null</span>;</pre><pre style="margin:0px"> </pre><pre style="margin:0px">    <span style="color:blue">using</span> (SPWeb web = contentType.ParentWeb)</pre><pre style="margin:0px">    {</pre><pre style="margin:0px">        <span style="color:green">// check if site column exists in the site</span></pre><pre style="margin:0px">        <span style="color:blue">foreach</span> (SPField field <span style="color:blue">in</span> web.AvailableFields)</pre><pre style="margin:0px">        {</pre><pre style="margin:0px">            <span style="color:blue">if</span> (field.InternalName == fieldName)</pre><pre style="margin:0px">            {</pre><pre style="margin:0px">                repositoryField = field;</pre><pre style="margin:0px">                <span style="color:blue">break</span>;</pre><pre style="margin:0px">            }</pre><pre style="margin:0px">        }</pre><pre style="margin:0px"> </pre><pre style="margin:0px">        <span style="color:green">// add site column if it does not exist</span></pre><pre style="margin:0px">        <span style="color:blue">if</span> (repositoryField == <span style="color:blue">null</span>)</pre><pre style="margin:0px">        {</pre><pre style="margin:0px">            <span style="color:blue">string</span> xml = <span style="color:#a31515">&quot;&lt;Field Name=\&quot;SentToTruthRepository\&quot; FromBaseType=\&quot;FALSE\&quot; Type=\&quot;DateTime\&quot; &quot;</span>;</pre><pre style="margin:0px">            xml += <span style="color:#a31515">&quot;DisplayName=\&quot;Sent to truth repository\&quot; Required=\&quot;TRUE\&quot; Format=\&quot;DateTime\&quot; &quot;</span>;</pre><pre style="margin:0px">            xml += <span style="color:#a31515">&quot;ReadOnly=\&quot;TRUE\&quot; Group=\&quot;Policy Columns\&quot; /&gt;&quot;</span>;</pre><pre style="margin:0px">            <span style="color:blue">string</span> newField = web.Fields.AddFieldAsXml(xml);</pre><pre style="margin:0px">            repositoryField = web.Fields.GetFieldByInternalName(newField);</pre><pre style="margin:0px">        }</pre><pre style="margin:0px">    }</pre><pre style="margin:0px">    <span style="color:green">// add field to content type</span></pre><pre style="margin:0px">    SPFieldLink newLink = <span style="color:blue">new</span> SPFieldLink(repositoryField);</pre><pre style="margin:0px">    contentType.FieldLinks.Add(newLink);</pre><pre style="margin:0px">    contentType.Update(<span style="color:blue">true</span>);</pre></div></pre>
<p><strong>Step 2 – Unregistering the policy</strong> 
<p>The method UnRegister on the policy feature is called when a policy is detached from a content type. This is the place to unregister the event handler that we created in the first step. You can also remove the extra site column from the content type, but I decided to leave it.<pre><div style="font-family:courier new;background:white;color:black;font-size:10pt"><pre style="margin:0px">    <span style="color:blue">public</span> <span style="color:blue">void</span> UnRegister(Microsoft.SharePoint.SPContentType ct)</pre><pre style="margin:0px">    {</pre><pre style="margin:0px">        <span style="color:blue">if</span> (ct == <span style="color:blue">null</span>)</pre><pre style="margin:0px">        {</pre><pre style="margin:0px">            <span style="color:blue">throw</span> <span style="color:blue">new</span> <span style="color:#2b91af">ArgumentException</span>();</pre><pre style="margin:0px">        }</pre><pre style="margin:0px">        SPEventReceiverDefinition delete = <span style="color:blue">null</span>;</pre><pre style="margin:0px">        <span style="color:blue">foreach</span> (SPEventReceiverDefinition eventReceiver <span style="color:blue">in</span> ct.EventReceivers)</pre><pre style="margin:0px">        {</pre><pre style="margin:0px">            <span style="color:blue">if</span> ((eventReceiver.Name == <span style="color:#a31515">&quot;Policy of Truth&quot;</span>) &amp;&amp; (eventReceiver.Type == SPEventReceiverType.ItemUpdated))</pre><pre style="margin:0px">            {</pre><pre style="margin:0px">                delete = eventReceiver;</pre><pre style="margin:0px">                <span style="color:blue">break</span>;</pre><pre style="margin:0px">            }</pre><pre style="margin:0px">        }</pre><pre style="margin:0px">        <span style="color:blue">if</span> (delete != <span style="color:blue">null</span>)</pre><pre style="margin:0px">            delete.Delete();</pre><pre style="margin:0px">    }</pre></div></pre>
<p><strong>Step 3 – Creating the event handler</strong> 
<p>The next step is to create the event handler we used in step 1. This will use the handler we created in the <a href="http://www.sharepointblogs.com/tonstegeman/archive/2007/02/12/19308.aspx">previous part.</a> This handler check the item for the policy rules and submits the item to the records center. The event handler is a normal event reveiver for SharePoint list event. For demo purposes I have only implemented the ItemUpdated event.<pre><div style="font-family:courier new;background:white;color:black;font-size:10pt"><pre style="margin:0px">    <span style="color:blue">public</span> <span style="color:blue">class</span> <span style="color:#2b91af">PolicyOfTruthHandler</span> : SPItemEventReceiver</pre><pre style="margin:0px">    {</pre><pre style="margin:0px">        <span style="color:blue">public</span> <span style="color:blue">override</span> <span style="color:blue">void</span> ItemUpdated(SPItemEventProperties properties)</pre><pre style="margin:0px">        {</pre><pre style="margin:0px">            DisableEventFiring();</pre><pre style="margin:0px">            RepositoryHandler repository = <span style="color:blue">new</span> RepositoryHandler();</pre><pre style="margin:0px">            <span style="color:blue">if</span> (repository.HandleListItem(properties.ListItem))</pre><pre style="margin:0px">            {</pre><pre style="margin:0px">                <span style="color:blue">string</span> truthFieldName = <span style="color:#a31515">&quot;Sent to truth repository&quot;</span>;</pre><pre style="margin:0px">                properties.ListItem[truthFieldName] = <span style="color:#2b91af">DateTime</span>.Now;</pre><pre style="margin:0px">                properties.ListItem.Update();</pre><pre style="margin:0px">            }</pre><pre style="margin:0px">            EnableEventFiring();</pre><pre style="margin:0px">        }</pre><pre style="margin:0px">    }</pre></div></pre>
<p>The RepositoryHandler you see here is the handler I created in the previous part of this series. The code to update the list item and set the date in the special site column, has moved from the repository handler to the event handler. The eventhandler first calls DisableEventFiring() to prevent the update of the list item by the policy from firing the event a second time. For the update this works, but for some strange reason the ItemUpdated event fires twice in the process. As soon as we call the SubmitFile method on the OfficialFile.asmx webservice, the event gets fired a second time. This way we end up with 2 documents in the records center each time we change an item. I’ve spent quite a bit of time trying to stop this, but I didn’t succeed. I decided to leave it as is, because I wanted to get the policy working and it is not a real world scenario. 
<p><strong>Step 4 – The rest of the policy feature</strong> 
<p>Our policy feature also implements the method “ProcessListItem”. According to the policy sample in the ECM Starter Kit (MOSS SDK), this method is called for list items of the content type that were added before the policy was in place. Items that we not handled by the vent handlers (because the event handlers were not there yet) will we processed by ProcessListItem when the policy is assigned. I tried to test this using my custom policy of truth, but couldn’t get it to work. 
<p>To be a full working solution our policy should also implement the OnCustomDataChange method. This is called when the custom setup of the policy is changed. In our case this is when an administrator changes the keywords. Our policy feature should then check which documents are considered as ‘truth documents’ and these should be added to the records center. 
<p><strong>Step 5 – Testing the solution</strong> 
<p>Here are the steps how I tested the custom policy: 
<ul>
<li>Create a new content type called “Whitepaper” 
<li>Create a new custom policy for this content type. Activate the Policy of Truth and set the keywords to SharePoint and WSS<br><img style="border-bottom:0px;border-left:0px;border-top:0px;border-right:0px" border=0 alt=policytest1 src="/Blog/Lists/Posts/Attachments/24/policytest1_d24ea292-b34e-4a0b-b306-5ab41aaf283c.png"> 
<li>Assign the content type to a document library<br><img style="border-bottom:0px;border-left:0px;border-top:0px;border-right:0px" border=0 alt=policytest2 src="/Blog/Lists/Posts/Attachments/24/policytest2_498fa86e-d8d4-4d46-a667-9c983c3866e5.png"> 
<li>Upload a new document to the document library and set the title to “The truth on SharePoint development”<br><img style="border-bottom:0px;border-left:0px;border-top:0px;border-right:0px" border=0 alt=policytest3 src="/Blog/Lists/Posts/Attachments/24/policytest3_7a91c72f-2ca2-4318-b81b-184eb2102361.png"> 
<li>Navigate to your records center and test if your document was submitted to the records center. It should be submitted as an unclassified record. Please note that my testdocument was uploaded twice. I explained the reason for that above in step 3.<br><img style="border-bottom:0px;border-left:0px;border-top:0px;border-right:0px" border=0 alt=policytest4 src="/Blog/Lists/Posts/Attachments/24/policytest4_75452009-8039-428c-8f3a-ebb9f816cc8d.png"> 
<li>Open one of the xml files in the “Properties” folder and notice that we also set a custom property while submitting the file to the repository: ‘SubmittedBy’.<br><img border=0 alt=policytest5 src="/Blog/Lists/Posts/Attachments/24/policytest5_5953cb56-9527-4fe4-9aa8-d0ff2cae89d8.png"> 
<li>Go back to the document library that has the document we just added. Change the view to include the field “Sent to truth repository” field. Notice that this field now has a value. This was set by the policy after successfully submitting the document to the records center.<br><img border=0 alt=policytest6 src="/Blog/Lists/Posts/Attachments/24/policytest6_2277c698-2686-440f-8e2c-5ffa57743e5f.png"> </li></ul>
<p>Overview of all parts: 
<ul>
<li><a href="/Blog/Lists/Posts/Post.aspx?ID=22">Part 1</a> – introduction and creating the policy feature 
<li><a href="/Blog/Lists/Posts/Post.aspx?ID=23">Part 2</a> – implementing the handler and submitting to a records center 
<li><a href="/Blog/Lists/Posts/Post.aspx?ID=24">Part 3</a> – implementing and testing the policy</li></ul>
<p><img src="http://www.sharepointblogs.com/aggbug.aspx?PostID=19518" width=1 height=1></p></div></div>
<div><b>Published:</b> 2/15/2007 8:56 AM</div>
<div><b>Attachments:</b> <a href="http://www.tonstegeman.com/Blog/Lists/Posts/Attachments/24/policytest1_d24ea292-b34e-4a0b-b306-5ab41aaf283c.png">http://www.tonstegeman.com/Blog/Lists/Posts/Attachments/24/policytest1_d24ea292-b34e-4a0b-b306-5ab41aaf283c.png</a><br><a href="http://www.tonstegeman.com/Blog/Lists/Posts/Attachments/24/policytest2_498fa86e-d8d4-4d46-a667-9c983c3866e5.png">http://www.tonstegeman.com/Blog/Lists/Posts/Attachments/24/policytest2_498fa86e-d8d4-4d46-a667-9c983c3866e5.png</a><br><a href="http://www.tonstegeman.com/Blog/Lists/Posts/Attachments/24/policytest3_7a91c72f-2ca2-4318-b81b-184eb2102361.png">http://www.tonstegeman.com/Blog/Lists/Posts/Attachments/24/policytest3_7a91c72f-2ca2-4318-b81b-184eb2102361.png</a><br><a href="http://www.tonstegeman.com/Blog/Lists/Posts/Attachments/24/policytest4_75452009-8039-428c-8f3a-ebb9f816cc8d.png">http://www.tonstegeman.com/Blog/Lists/Posts/Attachments/24/policytest4_75452009-8039-428c-8f3a-ebb9f816cc8d.png</a><br><a href="http://www.tonstegeman.com/Blog/Lists/Posts/Attachments/24/policytest5_5953cb56-9527-4fe4-9aa8-d0ff2cae89d8.png">http://www.tonstegeman.com/Blog/Lists/Posts/Attachments/24/policytest5_5953cb56-9527-4fe4-9aa8-d0ff2cae89d8.png</a><br><a href="http://www.tonstegeman.com/Blog/Lists/Posts/Attachments/24/policytest6_2277c698-2686-440f-8e2c-5ffa57743e5f.png">http://www.tonstegeman.com/Blog/Lists/Posts/Attachments/24/policytest6_2277c698-2686-440f-8e2c-5ffa57743e5f.png</a><br><a href=""></a></div>
]]></description>
      <author>Ton Stegeman</author>
      <pubDate>Thu, 01 Nov 2007 17:12:09 GMT</pubDate>
      <guid isPermaLink="true">http://www.tonstegeman.com/Blog/Lists/Posts/ViewPost.aspx?ID=24</guid>
    </item>
    <item>
      <title>Scripting SharePoint 2007 setup: choices and concepts</title>
      <link>http://www.tonstegeman.com/Blog/Lists/Posts/ViewPost.aspx?ID=134</link>
      <description><![CDATA[<div><b>Body:</b> <div class=ExternalClassE92A8BD82D4F4B03AF428AFF66AFD560><p>We are rebuilding our SharePoint 2007 environment that has a number of different farms:</p> <ul> <li>5 development servers  <li>1 test server  <li>1 staging server  <li>1 production environment with 1 application server, 2 web frontends and 1 database server</li></ul> <p>Because we want the SharePoint installation and configuration to be the same on every environment, we decided to script the installation. In this post I will describe some of the choices we have made and what concepts we used to meet specific requirements. Our final script is based on a number of samples that can be found at several locations on the internet (<a href="http://mindsharpblogs.com/ben/archive/2008/03/08/4411.aspx" target="_blank">Ben Curry/Mindsharp</a>, <a href="http://automossinstaller.codeplex.com/" target="_blank">automossinstaller</a> on CodePlex and <a href="http://stsadm.blogspot.com/2008/03/sample-install-script.html" target="_blank">Gary Lapointe</a>). I won’t post all our scripts, but just some relevant snippets.</p> <h4>STSADM vs PowerShell</h4> <p>First choice to make was the choice between using STSADM and PowerShell. Because most samples out there (that are very good) use STSADM, and our PowerShell knowledge is still a bit basic, we decided to go for the STDADM option. Most of the commands we use are out of the box SharePoint, but for some specific tasks we use custom command extensions by <a href="http://stsadm.blogspot.com" target="_blank">Gary Lapointe</a>. We realize that we will have to re-do our scripts for SharePoint 2010, because there PowerShell probably is the better option.</p> <h4>Parameters</h4> <p>After creating our scripts, we ended up with a number of scripts files for specific servers, and steps in the process. All these files have parameters to make it do what we want it to do. The header of each file defines all parameters used in that file, which looks like this:</p> <div id=codeSnippetWrapper> <div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px" id=codeSnippet><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> psconfig=&quot;C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\bin\psconfig.exe&quot;</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> stsadm=&quot;C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\bin\stsadm.exe&quot;</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> MOSSSP2_Path=C:\Install\MOSS2007X64\MOSS2007_with_SP2_X64</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> WSSSP2_LP_DutchPath=C:\Install\WSS30X64\WSS30_LP_with_SP2_X64</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> MOSSSP2_LP_DutchPath=C:\Install\MOSS2007X64\MOSS2007_LP_with_SP2_X64</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> OfficeServerConfigFilesPath=C:\Install\Deployment\Unattended_MOSS</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@rem  ==================== GENERAL PARAMETERS ===========================</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> <span style="color:#0000ff">Domain</span>=TSTMSS</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> Environment=o</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> SetupUserAccount=%<span style="color:#0000ff">Domain</span>%\svcmoss-install-%Environment%</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> Farmserviceaccount=%<span style="color:#0000ff">Domain</span>%\svcmoss-admin-%Environment%</pre></div></div>
<p>To manage these parameters easier, I created a simple WinForms application that extracts every parameter and it’s value in a CSV file. We manage the parameters for every environment in an <strong>Excel workbook</strong>, with a sheet for every server.</p>
<p><a href="/blog/Lists/Posts/Attachments/134/image_2_5BC423F4.png"><img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px" title=image border=0 alt=image src="/blog/Lists/Posts/Attachments/134/image_thumb_5BC423F4.png" width=244 height=158></a> </p>
<p>By exporting a sheet to a CSV file and feed that to the custom tool, we can easily create an installation set. This simply replaces the parameter values in the script files and copies the set of files to a new folder.</p>
<h4>Passwords</h4>
<p>One of the requirements we have is to keep the passwords for the service account very secure. We started off putting all parameters in the same Excel sheets as described above, but this is not exactly secure... We ended up creating a password text file that contains all service accounts used (per farm) and their passwords. Nobody has the permissions to read the file, except the SharePoint installer account. And of course our AD admins who create and manage service accounts and publish the text files.</p>
<p>In the script we are using the sample below to read a password from the password file:</p>
<div id=codeSnippetWrapper>
<div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px" id=codeSnippet><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> EnvironmentSuffix=o</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> <span style="color:#0000ff">Domain</span>=TSTMSS</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> Company=TSTTESTCOMPANY</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> SSPAccount=%<span style="color:#0000ff">Domain</span>%\svc-ssp%Company%-%EnvironmentSuffix%</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> PasswordFile=C:\mosspasswords.txt</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">for</span> /F &quot;usebackq tokens=1,2&quot; %%i <span style="color:#0000ff">in</span> (`type &quot;%PasswordFile%&quot;`) do IF %SSPAccount% == %%i <span style="color:#0000ff">set</span> SSPPassword=%%j</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> </pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@%stsadm% -o createssp ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -title &quot;%SSPNAME%&quot; ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -url %SSPAdminURL% ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -mysiteurl %MySiteHostURL% ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -indexserver &quot;%indexserver%&quot; ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -indexlocation &quot;%defaultindexlocation%&quot; ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -sspdatabaseserver &quot;%DatabaseServer%&quot; ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -sspdatabasename &quot;%SSPDatabaseName%&quot; ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -searchdatabaseserver &quot;%DatabaseServer%&quot; ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -searchdatabasename &quot;%SharedServicesSearchDB%&quot; ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -ssplogin %SSPAccount% ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -ssppassword %SSPPassword% ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> &gt;&gt;&quot;%<span style="color:#0000ff">date</span>% - MOSS_Installation_Log.txt&quot;</pre></div></div>
<p> </p>
<p>The first part of the script sets all parameters and reads a password, in this case for the account that runs the shared services provider. The second part of the script shows the stsadm command that creates the SSP, and uses the password setting.</p>
<p>This way SharePoint admins who install SharePoint do not need to know the password for the service accounts.</p>
<h4>Install SharePoint</h4>
<p>To install SharePoint on the web servers and on the application server, we first prepared a slipstreamed installation of SharePoint and SP2. A manual on how to slipstream SP2 into the installer can be found <a href="http://blogs.technet.com/seanearp/archive/2009/05/20/slipstreaming-sp2-into-sharepoint-server-2007.aspx" target="_blank">in this blog post</a> on the Sean Blog. Following the same procedure, we also prepared slipstream packages for the Dutch language packs (WSS and MOSS) and SP2.</p>
<p>Next step was to prepare the configuration XML files. <a href="http://technet.microsoft.com/en-us/library/cc261668.aspx" target="_blank">Technet</a> describes the options. We created 3 files; 1 for the application server, 1 for the web frontends and 1 for installing the language pack(s). Next action was to run the installation scripts on the app server and the WFE’s. Please note we only installed the bits at this point. The configuration wizard still has to do it’s work, but first we need to create databases.</p>
<h4>Databases</h4>
<p>In our environment, databases need to be created and managed by our DBAs. They decide on what drive the data and log files end up, and we want to specify initial database sizes. All of our SharePoint databases are created by the DBAs using a script. Including the SharePoint configuration database and the search databases. They were all created even before we started installing SharePoint. In our parameter Excel sheet (see above) we gathered the settings for every databases we need. The script generation tool simply copies them in the SQL script files that are sent to the DBA.</p>
<p>The TechNet ‘<a href="http://technet.microsoft.com/en-us/library/cc262869.aspx" target="_blank">Deploy using DBA-created databases</a>’ article summarizes which databases (and their collation) you will need,  who needs to be the owner and what account you need to give permissions. The following snippet shows the SQL script file that creates a new database:</p>
<div id=codeSnippetWrapper>
<div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px" id=codeSnippet><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#0000ff">DECLARE</span> @db_id <span style="color:#0000ff">smallint</span>;</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#0000ff">SET</span> @db_id = DB_ID(N<span style="color:#006080">'$(Databasename)'</span>);</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">IF @db_id <span style="color:#0000ff">IS</span> <span style="color:#0000ff">NULL</span></pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#0000ff">BEGIN</span></pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">    print <span style="color:#006080">'Create database $(Databasename)'</span>;</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">    <span style="color:#0000ff">CREATE</span> DATABASE $(Databasename) <span style="color:#0000ff">ON</span></pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">     (NAME = <span style="color:#006080">'$(Databasename)_Data'</span>,</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">      FILENAME = <span style="color:#006080">'$(DataFilePath)$(Databasename)_Data.mdf'</span>,</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">      SIZE=$(DatabaseSize),</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">      MAXSIZE=$(DatabaseMaxSize),</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">      FILEGROWTH=$(DatabaseFileGrowth))</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">     LOG <span style="color:#0000ff">ON</span></pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">     (NAME = <span style="color:#006080">'$(Databasename)_Log'</span>,</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">      FILENAME = <span style="color:#006080">'$(LogFilePath)$(Databasename)_Log.ldf'</span>,</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">      SIZE= 5,</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">      MAXSIZE=25,</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">      FILEGROWTH=5)</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">     <span style="color:#0000ff">COLLATE</span> Latin1_General_CI_AS_KS_WS;</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">    USE master;</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">    <span style="color:#0000ff">EXEC</span> sp_dboption <span style="color:#006080">'$(Databasename)'</span>, <span style="color:#006080">'autoclose'</span>, <span style="color:#006080">'FALSE'</span>;</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#0000ff">END</span>;</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#0000ff">ELSE</span></pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#0000ff">BEGIN</span></pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">    print <span style="color:#006080">'Database $(Databasename) already exists. Skip creation step.'</span>;</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#0000ff">END</span>;</pre></div></div>
<p>The print statements in this script write some information to the log file.<br>This snippet is used as in the sample below. It shows how this script (stored in <strong>CreateDatabase.sql</strong>) is used to create the content database for one of the web applications:</p>
<div id=codeSnippetWrapper>
<div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px" id=codeSnippet><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@rem  ==================== TEAMS PARAMETERS ===========================</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> TeamsDatabasename=WSS_Content_Teams</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> TeamsDataFilePath=C:\SQLData\Data\</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> TeamsLogFilePath=C:\SQLData\Log\</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> TeamsDatabaseSize=10MB</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> TeamsDatabaseMaxSize=50MB</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> TeamsDatabaseFileGrowth=5MB</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> TeamsLogSize=5MB</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> TeamsLogMaxSize=25MB</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> TeamsLogFileGrowth=5MB</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> TeamsApplicationPoolName=%Company%_CollaborationAppPool</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> TeamsApplicationPoolAccount=%<span style="color:#0000ff">Domain</span>%\svc-teams-%Company%-%EnvironmentSuffix%</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> </pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@echo %<span style="color:#0000ff">date</span>% - %<span style="color:#0000ff">time</span>% <span style="color:#0000ff">Create</span> database <span style="color:#0000ff">for</span> Teams &gt;&gt;&quot;%<span style="color:#0000ff">date</span>% - MOSS_Installation_Log.txt&quot;</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@echo Maak database voor Teams</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@sqlcmd -iSQL_CreateDatabase.<span style="color:#0000ff">sql</span> ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -vDatabasename=%TeamsDatabasename% ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -vDataFilePath=&quot;%TeamsDataFilePath%&quot; ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -vLogFilePath=&quot;%TeamsLogFilePath%&quot; ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -vDatabaseSize=%TeamsDatabaseSize% ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -vDatabaseMaxSize=%TeamsDatabaseMaxSize% ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -vDatabaseFileGrowth=%TeamsDatabaseFileGrowth% ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -vLogSize=%TeamsLogSize% ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -vLogMaxSize=%TeamsLogMaxSize% ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -vLogFileGrowth=%TeamsLogFileGrowth% ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -S%DatabaseServer% ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -vServername=%DatabaseServer% ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> &gt;&gt;&quot;%<span style="color:#0000ff">date</span>% - MOSS_Installation_Log.txt&quot;</pre></div></div>
<p>After creating the database you need to set the owner for the new database and grant a number of accounts permissions to the database (depending on which database; see the TechNet article above). The script below allows the accounts that are specified in the parameters CentralAdministrationApplicationPoolAccount and ApplicationPoolAccount access to the database. The first account gets to be the owner of the database and the second user is added to the db_owner role.</p>
<div id=codeSnippetWrapper>
<div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px" id=codeSnippet><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#0000ff">DECLARE</span> @db_id <span style="color:#0000ff">smallint</span>;</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#0000ff">SET</span> @db_id = DB_ID(N<span style="color:#006080">'$(Databasename)'</span>);</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">IF @db_id <span style="color:#0000ff">IS</span> <span style="color:#0000ff">NOT</span> <span style="color:#0000ff">NULL</span></pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#0000ff">BEGIN</span></pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">    print <span style="color:#006080">'Set permissions for database $(Databasename)'</span>;</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">    USE $(Databasename);</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">    <span style="color:#0000ff">EXEC</span> sp_grantlogin <span style="color:#006080">'$(CentralAdministrationApplicationPoolAccount)'</span>;</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">    <span style="color:#0000ff">EXEC</span> sp_grantlogin <span style="color:#006080">'$(ApplicationPoolAccount)'</span>;</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">    print <span style="color:#006080">'Change owner to $(CentralAdministrationApplicationPoolAccount)'</span>;</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">    <span style="color:#0000ff">EXEC</span> sp_changedbowner <span style="color:#006080">'$(CentralAdministrationApplicationPoolAccount)'</span>;</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">    IF <span style="color:#0000ff">NOT</span> <span style="color:#0000ff">EXISTS</span> (<span style="color:#0000ff">SELECT</span> * <span style="color:#0000ff">FROM</span> sysusers <span style="color:#0000ff">WHERE</span> name=<span style="color:#006080">'$(ApplicationPoolAccount)'</span>) <span style="color:#0000ff">EXEC</span> sp_grantdbaccess <span style="color:#006080">'$(ApplicationPoolAccount)'</span>;</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">    <span style="color:#0000ff">EXEC</span> sp_addrolemember <span style="color:#006080">'db_owner'</span>, <span style="color:#006080">'$(ApplicationPoolAccount)'</span>;</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#0000ff">END</span>;</pre></div></div>
<p></p>
<p></p>
<p></p>
<p>This script is saved in the file called <strong>SQL_SetOwner_AddOwnerRole.sql</strong> and called from the sample script below. This sets the correct permissions for the content database we just created in the previous script.</p>
<div id=codeSnippetWrapper>
<div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px" id=codeSnippet><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"></pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> EnvironmentSuffix=o</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> <span style="color:#0000ff">Domain</span>=TSTMSS</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> Company=TSTTESTCOMPANY</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> CentralAdministrationApplicationPoolAccount=%<span style="color:#0000ff">Domain</span>%\zsvcMSS</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> DatabaseServer=TSTMSS\SQLEXPRESS</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@rem  ==================== TEAMS PARAMETERS ===========================</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> TeamsDatabasename=WSS_Content_Teams</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> TeamsApplicationPoolName=%Company%_CollaborationAppPool</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> TeamsApplicationPoolAccount=%<span style="color:#0000ff">Domain</span>%\svc-teams-%Company%-%EnvironmentSuffix%</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> </pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@echo %<span style="color:#0000ff">date</span>% - %<span style="color:#0000ff">time</span>% START - Office Server Configuration &gt;&gt;&quot;%<span style="color:#0000ff">date</span>% - MOSS_Installation_Log.txt&quot;</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> stsadm=&quot;C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\bin\stsadm.exe&quot;</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> </pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@echo %<span style="color:#0000ff">date</span>% - %<span style="color:#0000ff">time</span>% Permissions <span style="color:#0000ff">for</span> Teams database &gt;&gt;&quot;%<span style="color:#0000ff">date</span>% - MOSS_Installation_Log.txt&quot;</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@echo Zet de rechten voor Teams database</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@sqlcmd -iSQL_SetOwner_AddOwnerRole.<span style="color:#0000ff">sql</span> ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -vDatabasename=%TeamsDatabasename% ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -S%DatabaseServer% ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -vServername=%DatabaseServer% ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -vCentralAdministrationApplicationPoolAccount=%CentralAdministrationApplicationPoolAccount% ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -vApplicationPoolAccount=%TeamsApplicationPoolAccount% ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> &gt;&gt;&quot;%<span style="color:#0000ff">date</span>% - MOSS_Installation_Log.txt&quot;</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@if <span style="color:#0000ff">not</span> errorlevel 0 <span style="color:#0000ff">goto</span> errorhandler</pre></div></div>
<p> </p>
<p>These SQL scripts are used for every database we needed in our SharePoint environment:</p>
<ul>
<li>Configuration database</li>
<li>Content database for Central Administration web application</li>
<li>Search admin database</li>
<li>Content database for the SSP Admin web applications</li>
<li>Content database(s) for the MySites</li>
<li>SSP databases (for 2 SSPs)</li>
<li>SSP Search databases</li>
<li>Content database for collaboration sites</li>
<li>Content database for intranet</li>
<li>Content databases for a number of SharePoint applications</li></ul>
<h4>Web applications</h4>
<p>To create web applications, we use the STSADM command extension <strong>gl-createwebapp</strong> by <a href="http://stsadm.blogspot.com/2007/10/create-web-application.html" target="_blank">Gary Lapointe</a>. The main reason for that is that we did not want our virtual directory path of the IIS website in the default location C:\inetpub. These home directories needed to be moved to another drive and the extension by Gary allowed us to do that. Except for the IIS website for the Central Administration sites. This is created automatically by PSConfig, and it does not allow you o specify the path. So this is the only website that still lives in c:\inetpub.</p>
<div id=codeSnippetWrapper>
<div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px" id=codeSnippet><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@rem  ==================== GENERAL PARAMETERS ===========================</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> EnvironmentSuffix=o</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> <span style="color:#0000ff">Domain</span>=TSTMSS</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> Company=TSTTESTCOMPANY</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> CentralAdministrationApplicationPoolAccount=%<span style="color:#0000ff">Domain</span>%\zsvcMSS</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> DatabaseServer=TSTMSS\SQLEXPRESS</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@rem  ==================== TEAMS PARAMETERS ===========================</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> TeamsDatabasename=WSS_Content_Teams</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> TeamsURL=http:<span style="color:#008000">//teams.tstlocal.nl</span></pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> TeamsHostHeader=teams.tstlocal.nl</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> TeamsDescription=Team sites voor %Company%</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> TeamsApplicationPoolName=%Company%_CollaborationAppPool</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> TeamsApplicationPoolAccount=%<span style="color:#0000ff">Domain</span>%\svc-teams-%Company%-%EnvironmentSuffix%</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> TeamsVirtualDirectory=C:\inetpub\mossroot\teams</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@rem  ==================== <span style="color:#0000ff">GET</span> PASSWORDS ===========================</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> PasswordFile=C:\mosspasswords.txt</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@echo off</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">for</span> /F &quot;usebackq tokens=1,2&quot; %%i <span style="color:#0000ff">in</span> (`type &quot;%PasswordFile%&quot;`) do IF %TeamsApplicationPoolAccount% == %%i <span style="color:#0000ff">set</span> TeamsApplicationPoolPassword=%%j</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@echo <span style="color:#0000ff">on</span></pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@rem  ===============================================================</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> </pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@echo %<span style="color:#0000ff">date</span>% - %<span style="color:#0000ff">time</span>% START - Office Server Configuration &gt;&gt;&quot;%<span style="color:#0000ff">date</span>% - MOSS_Installation_Log.txt&quot;</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@<span style="color:#0000ff">set</span> stsadm=&quot;C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\bin\stsadm.exe&quot;</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> </pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@echo %<span style="color:#0000ff">date</span>% - %<span style="color:#0000ff">time</span>% <span style="color:#0000ff">Set</span> <span style="color:#0000ff">default</span> SSP <span style="color:#0000ff">to</span> the SSP <span style="color:#0000ff">for</span> %Company% &gt;&gt;&quot;%<span style="color:#0000ff">date</span>% - MOSS_Installation_Log.txt&quot;</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@%stsadm% -o setdefaultssp ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -title &quot;Shared Services %Company%&quot; ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> &gt;&gt;&quot;%<span style="color:#0000ff">date</span>% - MOSS_Installation_Log.txt&quot;</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@if <span style="color:#0000ff">not</span> errorlevel 0 <span style="color:#0000ff">goto</span> errorhandler</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> </pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@echo %<span style="color:#0000ff">date</span>% - %<span style="color:#0000ff">time</span>% Make Teams web application <span style="color:#0000ff">on</span> url %TeamsURL% &gt;&gt;&quot;%<span style="color:#0000ff">date</span>% - MOSS_Installation_Log.txt&quot;</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@%stsadm% -o gl-createwebapp ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -url %TeamsURL% ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -directory &quot;%TeamsVirtualDirectory%&quot; ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -port 80 ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -sethostheader %TeamsHostHeader% ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -databaseserver %DatabaseServer% ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -databasename &quot;%TeamsDatabasename%&quot; ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -description &quot;%TeamsDescription%&quot; ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -apidname &quot;%TeamsApplicationPoolName%&quot; ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -donotcreatesite ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -apidtype configurableid ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -apidlogin %TeamsApplicationPoolAccount% ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> -apidpwd %TeamsApplicationPoolPassword% ^</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"> &gt;&gt;&quot;%<span style="color:#0000ff">date</span>% - MOSS_Installation_Log.txt&quot;</pre><pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:'Courier New', courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">@if <span style="color:#0000ff">not</span> errorlevel 0 <span style="color:#0000ff">goto</span> errorhandler</pre></div></div>
<p> </p>
<p>The sample script above shows how a new, empty, web application is created. Site collections will be added by another scripts. This script uses the content database that we had created in previous steps. In our SharePoint farm we have 2 SSPs. Before the web application is created, we make sure the default SSP is the SSP that we need to associate the web application with. This way the script ensures that all web applications will be associated with the right SSP.</p>
<h4>Summary</h4>
<p>In this post I have described the most important concepts we have applied when scripting our SharePoint installation. Instead of posting the full script, I have posted only relevant snippets. Hope you can use these snippets to make your own scripts do they need to do.</p></div></div>
<div><b>Published:</b> 3/27/2010 3:49 AM</div>
<div><b>Attachments:</b> <a href="http://www.tonstegeman.com/Blog/Lists/Posts/Attachments/134/image_2_5BC423F4.png">http://www.tonstegeman.com/Blog/Lists/Posts/Attachments/134/image_2_5BC423F4.png</a><br><a href="http://www.tonstegeman.com/Blog/Lists/Posts/Attachments/134/image_thumb_5BC423F4.png">http://www.tonstegeman.com/Blog/Lists/Posts/Attachments/134/image_thumb_5BC423F4.png</a><br><a href=""></a></div>
]]></description>
      <author>Ton Stegeman</author>
      <pubDate>Sat, 27 Mar 2010 10:49:17 GMT</pubDate>
      <guid isPermaLink="true">http://www.tonstegeman.com/Blog/Lists/Posts/ViewPost.aspx?ID=134</guid>
    </item>
  </channel>
</rss>