title: Powershell Script to create IIS
body: <p>I have following script to create an basic IIS site which is working</p>
  
  <pre><code>New-Website -Name "TestApp1" -Port 80 -IPAddress "192.168.1.222" -HostHeader "testapp1.example.com" -PhysicalPath C:\Powershell\TestCreateFolder1 -ApplicationPool "DefaultAppPool"
  </code></pre>
  
  <p>But I dont have this script working </p>
  
  <pre><code>$site_command = "-Name ""TestApp1"" -Port 80 -IPAddress ""192.168.1.222"" -HostHeader ""testapp1.example.com"" -PhysicalPath C:\Powershell\TestCreateFolder1 -ApplicationPool ""DefaultAppPool"""
  
  New-WebSite $site_command
  </code></pre>
  
  <p>I am getting this error</p>
  
  <pre><code>-Name "TestApp1" -Port 80 -IPAddress "192.168.1.222" -H
  ershell\TestCreateFolder1 -ApplicationPool "DefaultAppP
  New-Website : Invalid site name
  At C:\powershell\CreateIisSite.ps1:35 char:12
  + New-WebSite &lt;&lt;&lt;&lt;  $site_command
      + CategoryInfo          : InvalidData: (:) [New-Web
      + FullyQualifiedErrorId : Invalid site name
  ,Microsoft.IIs.PowerShell.Provider.NewWebsiteCommand
  </code></pre>