Great script. Despite the fact that this is not a question, I slightly changed it for batch processing.
First, I created a batch file that reads in the text file of the sites to be added, which refers to your slightly modified batch file just for creating websites (FTP is not required):
@Echo off :: --------------------------------------------------------------------------------------- :: Create Batched IIS 7 Site Entries :: :: Usage: CreateIISEntry.bat [websitename.com] (no www.) :: for /f %%X in (NewWebsiteEntries.txt) do CreateSingleIISEntry.bat %%X echo ... echo *** BATCH PROCESS HAS BEEN COMPLETED ***
NewWebsiteEntries.txt contains a list of created websites - one per line (without www):
site1.com site2.com site3.com
Finally, a batch file that creates entries:
@Echo off :: --------------------------------------------------------------------------------------- :: Create IIS 7 Site Entry :: :: Usage: CreateSingleIISEntry.bat [websitename.com] (no www.) :: --------------------------------------------------------------------------------------- :: Get variable from command %1 Root Domain Name. set rootDomainName = %1 :: This is the path to the Web Pages on the server. set WebFile=C:\inetpub\wwwroot\ :: ADD NEW Directory MKDIR %WebFile%%1 echo New Directory Created: %WebFile%%1 xcopy C:\inetpub\wwwroot\NewWebsiteHolding\*.* %WebFile%%1 :: ADD IIS ENTRY %windir%\system32\inetsrv\AppCmd ADD SITE /name:%1 /bindings:http/[YOUR IP ADDRESS OR *]:80:%1,http/[YOUR IP ADDRESS OR *]:80:www.%1 /physicalPath:%WebFile%%1 echo IIS Website Created: %1 and www.%1
Since in my case not all new sites will live immediately, by default I placed a site whose contents are copied to recently created site directories.
This will add all sites to the default application pool.
What about that.
source share