July 2011 - Posts
You can find this week’s video here.
This week's lesson covers how to perform staggered installs when IIS Shared Configuration is enabled. This is week 30 of a 52 week series for the web pro.
IIS Shared Configuration, used for webfarms, requires very little maintenance. However, there is one consideration that comes up commonly, which is how to install applications on the web servers when shared configuration is enabled.
This lesson walks through the steps necessary to take servers out of rotation without overwriting the good configuration, and without making the common mistake of getting the config and server installs out of sync.
The following checklist is the one that I chose to use in this video. You can use this for your reference.
- WE01 - take out of shared config
- WE01 - iisreset
- WE01 - install
- WE02 - take out of shared config
- WE02 - iisreset
- WE02 - install
- WE03 - take out of shared config
- WE03 - iisreset
- WE03 - install
- WE01 - export to shared config location
- WE01 - add back to shared config
- WE01 - iisreset
- WE02 - add back to shared config
- WE02 - iisreset
- WE03 - add back to shared config
- WE03 - iisreset
Since an iisreset is required to take a node out of rotation and then again to put it back in, it makes it difficult complete everything in a single pass.
There are some tricks that you can consider to perform this in a single pass:
- If you test and confirm that administration.config is not touched, then you may not need to perform the iisreset. Be careful though since the install process may cause administration.config to move back to the local configuration.
- You can consider turning off your server replication (DFS in my case) during the staggered install so that you can fully complete each node in a single pass.
- Another option I've heard mentioned is to push shared config to a new location. Of course you need to ensure that replication is addressed.
If you disable replication or publish to a new location then you can perform the following steps instead:
- WEB01 - take out of shared config
- WEB01 - iisreset
- WEB01 - install
- WEB01 - export to shared config location
- WEB01 - add back to shared config
- WEB01 - iisreset
- WEB02 - take out of shared config
- WEB02 - iisreset
- WEB02 - install
- WEB02 - export to shared config location or copy from WEB01
- WEB02 - add back to shared config
- WEB02 - iisreset
- Repeat WEB02 steps for all other nodes.
This is now the 5th week in a mini-series on web farms, and the 30th week of the entire series. You can view past and future weeks here:http://dotnetslackers.com/projects/LearnIIS7/
You can find this week’s video here.
You can find this week’s video here.
This video covers advanced under the hood tips and tricks for IIS Shared Config. If you are already familiar with Shared Config and want to go deeper, this video is for you.
We dig in deeper to IIS 7 (7.5) Shared Configuration in this week’s lesson. If you are already familiar with IIS Shared Config, or have seen last week’s lesson, than this will cover more of the internals. This week is a bit different in that Scott discovers a couple tricks while recording this video, so join with him on an adventure to learn more about this powerful feature in IIS. Advanced topics include the series issue with IIS backups and shared configuration, where the redirection meta information is saved, and how to workaround the password issues when joining servers back to shared configuration after maintenance.
This is now the 4th week in a mini-series on web farms, and the 29th week of the entire series. You can view past and future weeks here: http://dotnetslackers.com/projects/LearnIIS7/
You can find this week’s video here.
You can find this week’s video here.
IIS 7 (and 7.5) offers an extremely useful and easy to use feature for shared web farm situations, called Shared Configuration. This week walks through how to setup IIS Shared configuration, along with a few considerations necessary to administer web farms.
This is a mini sub-series on web farms. Last two weeks covered setting up a domain and setting up DFS-R for content and folder replication. This week starts in on keeping Internet Information Systems’s (IIS) configuration in sync between multiple web servers.
This is week 28 of a 52 week series for the Web Pro. Past and future videos can be found here: http://dotnetslackers.com/projects/LearnIIS7/
You can find this week’s video here.
There are times when it’s useful to have a script that runs on every server boot, but with a delay. For example, let’s say that you want a script to recycle IIS five minutes after starting the server due to some slow starting dependencies.
One of the issues with doing this is that if you add a delay to a startup script, it will delay completion of the Windows startup process. This isn’t a problem if you’re talking 30 seconds, but when you start talking in minutes, then it becomes a problem.
Or, this is useful not only for a delay, but also to allow the windows startup to complete while a long running script finishes in the background.
I’ve put together a process that defers the execution of the script to Scheduled Tasks, which will then run at the specified delay.
The flow looks like this:

There are 3 files required to perform this. They are:
- DelayStart.vbs –> Schedules the delayed execution using Scheduled Tasks
- StartupScript.bat –> (or whatever you want to call it). This is your script that you want to run.
- CleanupScheduledTask.bat –> This deletes the temporary scheduled task when it’s done. You will need to call this from StartupScript.bat
Note that schtasks.exe has a /Z parameter to auto delete itself when finished but it doesn’t appear to work for me. If it works for you, you can drop the Cleanup script from the workflow.
CleanupScheduledTask.bat needs to be called from StartupScript.bat. Alternately you can create 2 tasks. One runs your script and the other runs a few minutes later to delete both scheduled tasks.
To set this up, perform the following steps:
- Create a folder called c:\admin\autorun
- Create the three scripts as shown below
- Edit StartupScript.bat to your liking
- You can edit the first few lines of the scripts to use different paths or delays. My example is set for 5 minutes delay.
- Schedule DelayStart.vbs to run on startup:
- Start –> Run –> “gpedit.msc”
- Expand Computer Configuration\Windows Settings\Scripts
- Double Click Startup
- Click Add…
- Enter c:\admin\autorun\DelayStart.vbs for the Script Name
- Leave Script Parameters blank
- Click the OK button

All that is left to do is test and confirm that everything works as expected.
DelayStart.vbs
Option Explicit
Dim computer, delayMinutes, startupScript
computer = "."
delayMinutes = 5
startupScript = "c:\admin\autorun\StartupScript.bat"
Dim newTime, timeString, dateString
newTime = DateAdd("n", delayMinutes, Now())
timeString = Right("00" & DatePart("h", newTime), 2) & ":" & Right("00" & DatePart("n", newTime), 2) & ":00"
dateString = Right("00" & DatePart("m", newTime), 2) & "/" & Right("00" & DatePart("d", newTime), 2) & "/" & DatePart("YYYY", newTime)
Dim WshShell, cmd
Set WshShell = WScript.CreateObject("WScript.Shell")
'delete in case previous is still around
cmd = "schtasks /Delete /TN ""DelayedStartupScript"" /F"
WshShell.Run cmd, 1, True
cmd = "c:\windows\system32\schtasks.exe /create /tn DelayedStartupScript /tr """ & startupScript & """ /sc ONCE /sd " & dateString & " /st " & timeString & " /ru SYSTEM "
WshShell.Run cmd, 1, True
StartupScript.bat
:: Put whatever you want here. Just leave the bottom line.
:: This example recycles the app pool called DefaultAppPool
c:\Windows\System32\inetsrv\appcmd.exe recycle apppool "DefaultAppPool"
c:\admin\autorun\cleanupScheduledTask.bat
CleanupScheduledTask.bat
c:\windows\system32\schtasks /Delete /TN "DelayedStartupScript" /F
You can find this week’s video here.
This week’s video lesson covers the end to end process of installing DFS, adding shared folders, troubleshooting, and watching it in action.
Distributed File System Replication (DFS-R) is a powerful means of keeping the content on multiple servers in sync with each other. There are other options, like Robocopy and various 3rd party tools, but DFS-R is a native Windows App which works beautifully for most replication situations. It’s near immediate, easy to setup, easy to manage, and requires no maintenance.
This week’s video lesson covers the end to end process of installing DFS, adding shared folders, troubleshooting, and watching it in action.
Last week started a mini-series on web farms, so this week lays the foundation for Shared Configuration and other web server content replication discussions.
This is week 27 of a 52 week series for the Web Pro. Past and future videos can be found here: http://dotnetslackers.com/projects/LearnIIS7/
You can find this week’s video here.
More Posts