<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Nick Heppleston's BizTalk Blog &#187; IIS6</title>
	<atom:link href="http://www.modhul.com/category/iis6/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.modhul.com</link>
	<description>Experiences of a UK BizTalk Consultant</description>
	<lastBuildDate>Sun, 13 Mar 2011 17:01:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Replicate the IIS6 Metabase Between Nodes</title>
		<link>http://www.modhul.com/2007/08/16/replicate-the-iis6-metabase-between-nodes/</link>
		<comments>http://www.modhul.com/2007/08/16/replicate-the-iis6-metabase-between-nodes/#comments</comments>
		<pubDate>Thu, 16 Aug 2007 10:07:23 +0000</pubDate>
		<dc:creator>Nick Heppleston</dc:creator>
				<category><![CDATA[IIS6]]></category>

		<guid isPermaLink="false">http://www.modhul.com/2007/08/16/replicate-the-iis6-metabase-between-nodes/</guid>
		<description><![CDATA[I know that this is a little off-topic, but here goes&#8230;. A colleague asked me to have a look at replicating the IIS6 Metabase between two load-balanced web servers that form the front-end of a larger BizTalk environment. After my protests of &#8216;but I&#8217;m a BizTalk guy&#8217; fell on deaf ears and I started to [...]]]></description>
			<content:encoded><![CDATA[<p>I know that this is a little off-topic, but here goes&#8230;. A colleague asked me to have a look at replicating the IIS6 Metabase between two load-balanced web servers that form the front-end of a larger BizTalk environment. After my protests of &#8216;but I&#8217;m a BizTalk guy&#8217; fell on deaf ears and I started to investigate the problem, I was pleasantly surprised with the functionality provided &#8216;out of the box&#8217; by IIS; of particular interest to the replication problem were following two VBS scripts:</p>
<ul>
<li><strong>IIsCnfg.vbs</strong> -Performs Metabase replicated between IIS6 nodes or exported/imported to file.</li>
<li><strong>IIsBackup.vbs</strong> &#8211; Performs Metabase backups/restores and provides the facility to list and delete existing backups.</li>
</ul>
<p>So how do we go about using these scripts? They exist in the <code>C:\WINDOWS\System32\</code> directory and are all well documented (just execute the script with the help switch (/?) and the list of possible options are presented.</p>
<p><strong>Backing Up the IIS Metabase</strong></p>
<p>To perform a daily (scheduled) backup of the metabase on the local machine, I would suggest running something along the following lines:</p>
<blockquote><p><code>C:\</code><code>WINDOWS</code><code>\System32\iisback.vbs /backup /b DailyBackup</code></p></blockquote>
<p>If you wanted to backup the Metabase on a remote machine, simply add the /s (server) switch: this indicates the remote server on which to run the backup (note in the previous example, where no /s switch is supplied, the script defaults to the local server):</p>
<blockquote><p><code>C:\</code><code>WINDOWS</code><code></code><code>\System32\iisback.vbs /s winbtiis02 /backup /b DailyBackup</code></p></blockquote>
<p>If we wanted to review the backup history, we can list the backups on a local (or remote) server, using the /list switch, as follows:</p>
<blockquote><p><code>C:\</code><code>WINDOWS</code><code></code><code>\System32\iisback.vbs /list</code></p></blockquote>
<p>which produces the following output (note the last backup in the list &#8211; The IIS Setup automatically creates a backup at the end of its run):</p>
<blockquote><p><code>Connecting to server ...Done.<br />
Backup Name                        Version #      Date/Time<br />
========================================================================<br />
DailyBackup                        0              14/08/2007 17:08:49<br />
DailyBackup                        1              14/08/2007 17:08:58<br />
DailyBackup                        2              16/08/2007 11:04:38<br />
DailyBackup                        3              16/08/2007 11:04:41<br />
DailyBackup                        4              16/08/2007 11:04:43<br />
DailyBackup                        5              16/08/2007 11:04:44<br />
DailyBackup                        6              16/08/2007 11:04:46<br />
DailyBackup                        7              16/08/2007 11:04:47<br />
Initial Backup - created automatically by IIS setup 1 15/07/2007 23:28:59</code></p></blockquote>
<p>To delete a backup on a local (or remote) server, use the /list switch along with the /b (backup name) and /v (version number) switches:</p>
<blockquote><p><code>C:\</code><code>WINDOWS</code><code>\System32\iisback.vbs /delete /b DailyBackup /v 0</code></p></blockquote>
<p>This command would delete version zero of the &#8216;DailyBackup&#8217; backup. Remember, if you want to run these commands on a remote server, just add the /s switch and the remote server name!</p>
<p><strong>Replicating the IIS Metabase</strong></p>
<p>The IIsCnfg.vbs script performs a number of different functions &#8211; including importing and exporting Metabase config files, saving the Metabase to disk etc. &#8211; but the one I was particularly in was the replication functionality offered through the /copy switch.</p>
<p>To replicate the IIS Metabase from one server to another, the following command can be used:</p>
<blockquote><p><code>C:\</code><code>WINDOWS</code><code>\System32\iiscnfg.vbs /copy /s winbtiis01 /ts winbtiis02 /tu Username /tp Password</code></p></blockquote>
<p>The /copy switch indicates that the Metabase is to be replicated from the source server (specified in the /s switch &#8211; not necessarily required) to the target server (the /ts switch) using the target server user (the /tu switch) and target server password (the /tp switch).</p>
<p>The script is essentially a wrapper for a backup and restore operation (using the IIsBack.vbs script mentioned above) &#8211; go and have a look at the code if you&#8217;re interested (the function in question is called <em>Repl </em>and starts on line 721). In a nutshell, it performs the following operations:</p>
<ul>
<li>Backs-up the source server Metabase (and forces an overwrite of an existing backp if necessary), creating a backup with the name <em>iisreplback</em>;</li>
<li>Maps drives on both the source and destination servers using the next available drive letters (which may be different on the two servers);</li>
<li>Copies the backup created above to the destination server (the backup is taken from C:\WINDOWS\System32\inetsrv\metaback\ and written to the same directory on the destination server)</li>
<li>Unmaps the drive to the source server;</li>
<li>Restores the backup (on the remote server) using the IIsBack.vbs script;</li>
<li>Unmaps the drive to the destination server;</li>
</ul>
<p><strong>A Usable Replication Script</strong></p>
<p>Armed with this newfound knowledge, I put together the following batch script to backup the Metabase (on the source and destination servers) and replicate between the two; finally the script lists the backups on both servers for auditing purposes. I&#8217;m sure I could have done this in VBS, but any with the words VB in the name gives me the willies&#8230;..</p>
<blockquote><p><code># Backup the IIS Metabase on WINBTIIS01 and 02<br />
C:\</code><code>WINDOWS</code><code>\System32\iisback.vbs /s winbtiis01 /backup /b DailyBackup<br />
C:\</code><code>WINDOWS</code><code>\System32\iisback.vbs /s winbtiis02 /backup /b DailyBackup<br />
</code></p>
<p><code> # Replicate the IIS Metabase from WINBTIIS01 to 02<br />
C:\</code><code>WINDOWS</code><code>\System32\iiscnfg.vbs /copy /s winbtiis01 /ts winbtiis02 /tu Username /tp Password<br />
</code></p>
<p><code> # List the IIS Metabase backups on both WINBTIIS01 and 02<br />
C:\</code><code>WINDOWS</code><code></code><code>\System32\iisback.vbs /s winbtiis01 /list<br />
C:\</code><code>WINDOWS</code><code></code><code>\System32\iisback.vbs /s winbtiis02 /list</code></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.modhul.com/2007/08/16/replicate-the-iis6-metabase-between-nodes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

