Tag Archives: web site

How i automate website creation with Powershell

If you, like me, create lots and lots of websites almost every day you probably noticed that a lot of the things you do are repetitive.

I have a lot of rules that almost all my websites follow.

  • I name the pool, the site and the folder the same (like site.domain.com)
  • I always add a binding following the pattern 17000 + site id, so a site with site id 13 has a binding for localhost:17013
  • I set idle time-out to 0
  • I add a scheduled recycle at 02:00 (for load balanced environments att set it at 03:00 for the other node)
  • I always create a scheduled job to take care of log rotation

To avoid making misstakes, and to make sure it gets done the same way every time, i use this Powershell. It’s not perfect, but it works for me, and it does exactly what i need it to.

In the end of the script, where the scheduled job is created, i use a little application called LogRotate which i may publish on the internet. In the mean time, you can use it as a way to add a scheduled task.

Maybe it will work for you as well, or maybe you can pick the parts you need. Enjoy!