Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 503
  • Last Modified:

Automate common tasks of new site creation

I'd like some assistance creating a batch file (or possibly powershell, but I haven't looked into that enough yet) that will automate some common tasks that I perform when I create a new website (the site name will be passed as an argument)  The tasks are as follows (assuming domain name is example.com):

- Create username that is the sitename minus the TLD (example.com becomes example)
- Add this user to the group "Web Site Managers"
- Create directory C:\Sites\example.com with two folders, logs & www
- Add 2 sites, one for example.com and one for www.example.com
- Set example.com home directory to C:\Sites\example.com and set HTTP Redirect (301) to www.example.com
- Set home directory for www.example.com to C:\Sites\example.com\www
- Set logging directory for both sites to be C:\Sites\example.com\logs
- Set .NET user [Network Service] to have full permissions on C:\Sites\example.com\www
- Create FTP virtual directory for the user (directory name equals user name) under the DefaultFTPSite with the FTP login directory being C:\Sites\example.com

If someone could also provide resources (lilnks, books, etc) on documentation that will help me achieve all of this, I would be as willing to award points as if they had written the script for me myself.  This is a learning experience for me.  Thanks in advance for all your help.
  • 3
  • 2
2 Solutions
IIS7 also ships with "AppCmd.exe" that can be used to script most tasks related to web site set up and administration.

eohnsAuthor Commented:
Thank you guys for your help, but do you have any resources regarding the FTP aspect?
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

In Powershell you can create the folders using New-Item and add the ACLs via Set-ACL. You would have to create the FTP site via the IIS 7 Powershell CMDLets or WMI
eohnsAuthor Commented:
I want to thank everyone for their help.  I'm going to close this question because I don't think I'll be getting any more replies, but I will split the points between the 3 of you.  Thanks again for all your help.
eohnsAuthor Commented:
I split the points giving the Expert who responded twice and with links the most.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now