title: Configuring IIS with Powershell - Enable Forms Authentication
body: <p>My IIS looks like this:</p>
  
  <pre><code>Sites -&gt;
          Default Web Site -&gt;
                              MyWebApp
  </code></pre>
  
  <p>Then the question is: How do I enable Forms Authentication on MyWebApp? I mange to change or edit Anonymous Access, Basic, and Windows Auth. However, Forms Auth is not that easy. How do I do this in Powershell?</p>
  
  <p>I'm able to read the setting this way: </p>
  
  <p><code>(Get-WebConfiguration system.web/authentication 'IIS:\sites\Default Web Site\MyWebApp').Mode</code></p>
  
  <p>I'm having trouble or no luck with Set-Webconfiguration, or Set-Webconfigurationproperty. I find these cmdlets hard to figure out.</p>
  
  <p>Change happens in web.config, at least the web.config updates when I hit Enable or Disable on Forms Authentication at the IIS manager. Any clues and tips are highly appreciated.</p>