title: How can I add a section to a web.config using PowerShell?
body: <p>How can I add a section to <code>system.serviceModel</code> in a web.config, if it doesn't already exist?</p>
  
  <p>Before:</p>
  
  <pre><code>&lt;system.serviceModel&gt;
    &lt;serviceHostingEnvironment aspNetCompatibilityEnabled="true" /&gt;
  &lt;/system.serviceModel&gt;
  </code></pre>
  
  <p>After:</p>
  
  <pre><code>&lt;system.serviceModel&gt;
   &lt;serviceHostingEnvironment aspNetCompatibilityEnabled="true" /&gt;
   &lt;bindings&gt;
        &lt;basicHttpBinding&gt;
          &lt;binding name="ValidationServiceSoap" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"&gt;
            &lt;readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
            &lt;security mode="Transport"&gt;
              &lt;transport clientCredentialType="Ntlm" /&gt;
              &lt;message clientCredentialType="UserName" /&gt;
            &lt;/security&gt;
          &lt;/binding&gt;
        &lt;/basicHttpBinding&gt;
   &lt;bindings&gt;
  &lt;/system.serviceModel&gt;
  </code></pre>