By Walter Oliver

December 2, 2007


AppCmd.exe can be used to provision Web sites and run many commands to edit configuration.

Creating and Configuring

Use the following code samples for implementing AppCmd.exe.

To create a site and an application pool (with failed request tracing and W3svc log file locations)

%windir%\system32\inetsrv\Appcmd add AppPool -name:%poolname% -processModel.username:%poolaccount% -processModel.password:%poolaccountpwd% -enable32BitAppOnWin64:true

%windir%\system32\inetsrv\AppCmd add site -name:%sitename% -bindings:http/*:80:%sitename% -physicalPath:%sitepath%

%windir%\system32\inetsrv\Appcmd set app -applicationPool:%poolname%

To configure the Failed Request Tracing log file location

%windir%\system32\inetsrv\AppCmd set config <sitename>\\remoteserver\content$\<sitename>\logs\failedReqLog

To configure the W3SVC log file location

%windir%\system32\inetsrv\AppCmd set config <sitename>\\remotefileshare\content$\<sitename>\logs\logfiles