My company recently purchased two new servers that run Windows 2000 and IIS 5.0, and I'm preparing to add them to the network. As practice, I've been using the Microsoft Windows 2000 Server Resource Kit's IIS Migration Wizard with bogus information to migrate from IIS 4.0. This method has worked well. However, I've noticed that after I migrate the Web server from IIS 4.0 to IIS 5.0, the metabase retains the IIS 4.0 server's IP address as well as the path to the IIS 4.0 server's home directory. Can I use a script or the metabase editor (MetaEdit) to change all the settings at once so that I don't have to change each metabase entry manually?
The IIS Migration Wizard is useful but, as you've discovered, a bit quirky. After you've migrated your Web sites, you must inspect your target server thoroughly to avoid unexpected or incorrect settings. Such settings include not only IP addresses and pathnames for Web sites and virtual directories but also application configurations and mappings.
In particular, certain migration scenarios seem to cause problems for the wizard. For example, if the source server's Web site content resides on the D drive but the target server's Web site content resides on the E drive, pathnames won't migrate correctly. So, how can you correct the pathnames? If you have a site with hundreds of virtual directories or a server with hundreds of Web sites, finding a solution could be quite a challenge.
You can use Active Directory Service Interfaces (ADSI) scripts to perform almost any task, but I have another solution that doesn't require scripting at all. Let's presume that your task is to update every instance of a known path with a new path. Using MetaEdit 2.2, which you can download from http:// download.microsoft.com/download/ iis50/utility/5.0/nt45/en-us/mtaedt22 .exe, you can export your metabase to a text file, as Figure 1 shows.
The Export Text File menu option creates a specialized text file that contains the entire metabase or a selected portion of it. The structure of the text file is similar to the files that regedt32 creates. In addition, because the file is a text file, you can use your favorite text editor to perform simple search and replace operations.
Unfortunately, however, this process isn't as easy as it sounds. Just because the file is a text file doesn't mean that it contains text. In fact, most of the contents are hexadecimal values that don't make much sense. For example, Figure 2 shows an excerpt from the exported text metabase entry in the IISSamples virtual directory on my Win2K Professional machine. You can see that the path is 633A5C696E657 47075625C69697373616D706C6573, which is a hex value representing the ASCII characters that Figure 3, page 6, shows. (For a full list of ASCII values, go to http://www.asciitable.com.)
So, on your target system, let's say you want to map your 500 Web sites and virtual directories to D:\inetpub. You just need to convert the C of C:\inetpub, which is hex 63, to the D of D:\inetpub, which in turn is hex 64. To do so, open Microsoft Notepad, search for 633A5C696E6574707562, and replace that value with 643A5C69 6E6574707562. You use the entire string C:\inetpub so that you don't change other mappings in the metabase that indicate the location of log files or application mappings. After you've converted the hex value, you simply import the new text file and your metabase will point to the correct location.