Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


September 2002

IIS Informant: Using MetaEdit 2.2 to Resequence Virtual Directories

RSS
Subscribe to Windows Web Solutions | See More Virtual Directories Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

I have a Web site with about 50 virtual directories listed in order of creation. I could manage the virtual directories more easily if I could sort them alphabetically, but I haven't figured out how to do so. When I try to sort the virtual directory list in the Microsoft Management Console (MMC) Internet Information Services snap-in by selecting the Name field in the right pane, the listings remain sorted by creation date. Can you help?

You'll find that MMC behaves a bit differently depending on which version you have. All versions let you sort on the Name column in the details pane—at least sort of. In version 1.0 (Windows NT 4.0), the names are sorted alphabetically but gathered by type. In version 1.2 (tested on Windows 2000), the names are sorted alphabetically but the virtual directories are intermingled with files and regular folders.

What's stranger still is that although the Internet Information Services snap-in doesn't list virtual directories alphabetically, they appear alphabetically when you use MetaEdit to view the metabase. All this confusion aside, you can resequence your directories relatively painlessly—although the process is somewhat tedious.

Use MetaEdit 2.2 to export your metabase settings to a text file. You can then manipulate the text file to resequence the virtual directories and reimport your reorganized settings. To do so, first back up your metabase. Then, open MetaEdit and open the Root key of the Web site instance number. For example, start MetaEdit, and in the left panel, expand LM, W3SVC, then Web site instance 1 to display the Default Web Site for a default installation.

To find which of the Web site numbers is the correct one for the Web site, you can use trial and error. Select an instance, then in the right-hand pane, locate the Web site name, which is in the Data field of the metabase key with the name ServerComment. When you find the correct Web site name, you've found the Web site number. For example, Figure 2 shows that 1 is the Web site number for the Default Web Site. You can also find the Web site number through a script in the Adminscripts folder called FindWeb.vbs. If you provide FindWeb.vbs with the name of a Web site, it returns information about the site including the Web site number. On a default installation, you can type

c:\inetpub\adminscripts  findWeb.vbs "Default Web Site"

at a command prompt, which would return

Web Site Number = 1
  Web Site Description =
    Default Web Site
    Hostname =
    Port = 80
    IP Address =

After you identify the Web site number, you can locate the Root key in the Web site's metabase, which Figure 2 shows. When you open this key, you see the listings for virtual directories as well as for other directories and possibly for files. With the Root key selected, as Figure 3 shows, select Metabase, Export Text File, and provide a path and a name for the text file that will contain the Root key settings.

Using Notepad, open the text file and examine the contents. Note the well-organized structure, which contains the exported Root key. You can easily identify the virtual directory definitions because they have this structure:

[/LM/W3SVC/<Web site number>
  /Root
  /<virtual directory name>]

On my demonstration server, for example, I have [/LM/W3SVC/1/Root/Certsrv] and [/LM/W3SVC/1/Root/Demos]. Carefully copy the definitions in the directory listing sequence you desire. Make sure you have only one blank line between each listing.

After you complete the reorganization, save the text file. Although nothing we've done so far has placed the metabase itself at risk of being changed, that all ends here.

At this point, stop all Web services. In IIS 5.0, you use the IISRESET /STOP command. In IIS 4.0, you stop the IIS Admin Service by using NET STOP IISADMIN. Close MetaEdit, then open the Internet Services Manager console and locate the Web site you want to reorganize. Delete the Web site's virtual directories, then close the console.

Open MetaEdit and import the modified text file. Close MetaEdit, then open the Internet Services Manager console again. Your virtual directories are now in the sequence you specified. Restart the Web server.

Despite the work required to gain the benefit, if your IIS directory structure is relatively stable and you reference it frequently, the effort might be worth it. A couple of quick caveats about this technique: I don't like to have both the Internet Services Manager console and MetaEdit open at the same time. Because both update the same data store, you don't want older information from one of the applications to update the metabase while you're editing in the other application. Note that if you use MetaEdit 2.1 (which is included in the Microsoft Windows 2000 Resource Kit), editing the metabase with both tools open can cause the server to be unstable (i.e., blue screen). You should use MetaEdit 2.2, which you can download at http://downloadmicrosoft.com/download/iis50/utility/5.0/nt45/en-us/mtaedt22.exe.

End of Article



Reader Comments

You must be a registered user or online subscriber to comment on this article. Please log on before posting a comment. Are you a new visitor? Register now




Top Viewed ArticlesView all articles
Anti-Virus Vendors Prepare for War with Microsoft ... Again

When Microsoft announced its Windows Live OneCare security and PC health product over five years (as MSN OneCare), Symantec, McAfee, and the other consumer-oriented security vendors reacted with stunning vigor. ...

What You Need to Know About Microsoft's x64 Server Product Plans

What do Longhorn Server, Windows Compute Cluster Server, and Windows Vista have in common? The x64 platform. ...

Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...


IIS and Web Administration Whitepapers Improve SharePoint Performance By Optimizing Network Traffic

Related Events WinConnections and Microsoft® Exchange Connections

Check out our list of Free Email Newsletters!

Windows OSs eBooks Understanding and Leveraging Code Signing Technologies

A Guide to Windows Certification and Public Keys

Keeping Your Business Safe from Attack: Monitoring and Managing Your Network Security

Related IIS and Web Administration Resources Introducing Left-Brain.com, the online IT bookstore
Looking for books, CDs, toolkits, eBooks? Prime your mind at Left-Brain.com

Discover Windows IT Pro eLearning Series!
Clear & detailed technical information and helpful how-to's, all in our trademark no-nonsense format

Test Drive IT Solutions and Get Free Music Downloads
Solve your toughest IT problems with these free downloads and receive 5 free music downloads!


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home asp.netPRO Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2009 Penton Media, Inc. Terms of Use | Privacy Statement | Reprints and Licensing