1 adding applications to the pool
Appcmd.exe add apppool/name:test.com/managedruntimeversion: "v4.0"/managedpipelinemode: "Integrated"
2 add site, specify site name, bind, physical path
Appcmd.exe add Site/name: "test.com"/id:1/bindings:http/*:81 :/physicalpath: "E:\webroot\ test.com\web "
3 designated sites for the city pool
Appcmd.exe set Site/site.name: "test.com" /[path= '/']. applicationpool:test.com
4 The default document for the specified site is index.aspx
Appcmd.exe set config "test.com/"/section:defaultdocument/+files. [@start, value= ' index.aspx ']/commit: "test.com"
5 closing script execution permissions for a specific directory
Appcmd set config "test.com/download"/section:handlers/accesspolicy:read
6 exporting all application process pools on a machine
%windir%/system32/inetsrv/appcmd list Apppool/config/xml > C:/apppools.xml
7 Exporting all sites on 1 machines
%windir%/system32/inetsrv/appcmd list Site/config/xml > C:/sites.xml
8 Import all Process pools
%windir%/system32/inetsrv/appcmd Add Apppool/in < C:/apppools.xml
9 Import All Sites
%windir%/system32/inetsrv/appcmd Add Site/in < C:/sites.xml
The following is a batch script
10 Authorization to site files
ICACLS e:\webroot\test.com\ /inheritance:e /Grant:r"IIS apppool\test.com": R
icacls e:\webroot\test.com\* &NBSP; /inheritance:e / GRANT:R&NBSP; "IIS apppool\test.com"
ICACLS e:\webroot\test.com\download /grant:m "IIS apppool\test.com": R
ICACLS e:\webroot\test.com\download\* /grant:m "IIS apppool\test.com": R
Set sitename=test.comset sitepath=e:\webroot\ Test.comset logpath=g:\logfileset defaultdocument= ' index.aspx ' Set is32bitapp =falseset BackPort=99set netversion=v4.0set Cache=Cache%windir%\system32\inetsrv\Appcmd add Apppool /name:%sitename% /managedruntimeversion:%netversion% /managedpipelinemode: " Integrated " /enable32bitapponwin64:false%windir%\system32\inetsrv\appcmd add site /name:"% Sitename% " /id:100 /bindings:http/*:%backport%:,http/*:80:%sitename% /physicalpath: %sitepath% /logfile.directory:%logpath%%windir%\system32\inetsrv\appcmd set site / Site.name: "%sitename%" /[path= '/'].applicationpool:%sitename%%windir%\system32\inetsrv\appcmd set config "%sitename%/" /section:defaultdocument /+files. [@start, Value=%defaultdocument%] /commit: "%sitename%" ICACls %sitepath% /inheritance:e /grant:r "iis apppool\%sitename%": RICACLS %SitePath %\* /inheritance:e /grant:r "Iis apppool\%sitename%":ricacls %sitepath%\%cache% /inheritance:e /grant:r "iis apppool\%sitename%": ricacls %sitepath%\%cache% / inheritance:e /grant:r "iis apppool\%sitename%": R
This article is from the "Skybug" blog, make sure to keep this source http://skybug.blog.51cto.com/132577/1592050
IIS7.5 APPCMD simple usage and examples