Windows Server 2008でIIS7.0をコマンドラインから設定

featuresやrolesを追加

servermanagercmd.exe -install [features...]
servermanagercmd.exe -install [roles...]

サイトを追加

C:\windows\system32\inetsrv\appcmd.exe add site /name:testsite.com /bindings:"http/*:80:testsite.com,http/*:80:www.testsite.com,https/192.168.1.100:443:" /physicalPath:"F:\Inetpub\wwwroot\testsite"

バーチャルディレクトリを追加

C:\Windows\System32\inetsrv\appcmd.exe add vdir /app.name:testsite/ /path:/vdir1 /physicalPath:F:\Inetpub\vdir1

バーチャルディレクトリのアクセスポリシーを変更

C:\Windows\System32\inetsrv\appcmd.exe set config "testsite/vdir1" /section:handlers /accessPolicy:Read,Script,Execute /commit:apphost

Webアプリで使用するDLLを追加

C:\Windows\System32\inetsrv\appcmd.exe set config "testsite/vdir" -section:handlers /+[name='test.dll',path='test.dll',verb='*',modules='IsapiModule',scriptProcessor='F:\Inetpub\vdir1\test.dll',resourceType='File',requireAccess='Execute'] /commit:apphost


C:\Windows\System32\inetsrv\appcmd.exe set config -section:isapiCgiRestriction -+[path='F:\Inetpub\vdir1\test.dll',allowed='true']