Category Archives: 206

Cleanup Old Log Files (revisited)

Back in Nov-2006 I wrote about a free script (WaRmZip) you could download to be used for deleting old log files. That script includes a lot of features and flexibility.

Here’s a simpler script that does a similar cleanup of old log files that you might find useful. It includes a .vbs backend script plus a simple one line .bat batch file script that can be added to your SBS scheduler.

1. You can download a zip file from my website that contains the .vbs file, a sample .bat file and a sample log file. To keep things simply, I store these files on my SBS server’s in a C:\scripts folder.

2. The .vbs file does not need any editing at all. It is designed to search, starting at a specified folder, plus all sub folders below it. Howerver, if you wish to play it safe while testing, you can edit the .vbs file and remark out the file.delete line located on line 37 near the end of the script.

3. The .bat file will define the starting folder and the age of files to be deleted, and will create a log file so you can track the files deleted. This batch file can then be scheduled to run daily, weekly or whatever. You can either create separate batch files or just add additional cscript lines to this one batch file.

Here’s an example of the batch file IU use to cleanup IIS log files over 30 days old:

cscript c:\scripts\deloldfiles.vbs c:\windows\system32\logfiles 30 >> c:\scripts\iis.log

And here is part of the corresponding log file it creates:

Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
Today:12/29/2007 8:32:06 AM
Started deleting files older than :11/29/2007 8:32:06 AM
Deleting Files under the Folder:C:\WINDOWS\system32\LogFiles
Deleting C:\WINDOWS\system32\LogFiles\IN071105.log last modified: 11/5/2007 7:18:34 PM
Deleting C:\WINDOWS\system32\LogFiles\IN071110.log last modified: 11/10/2007 3:47:43 PM
Deleting C:\WINDOWS\system32\LogFiles\IN071118.log last modified: 11/18/2007 11:55:00 AM
Deleting C:\WINDOWS\system32\LogFiles\IN071123.log last modified: 11/23/2007 11:43:26 PM
Completed deleting files older than :11/29/2007 8:32:06 AM


Cleanup log files

I stumbled across a handy Windows script file (WaRmZip) that is an all purpose utility for cleaning, compressing and/or moving outdated log files. For example, you may want to delete certain files older than X days. You can download this utility at WinAdmin’s web site:

One use of this utility is to delete older IIS log files. Go to C:\Windows\System32\LogFiles directory on your server, and take a look at the contents of each of the subfolders (W3SVC1, etc).  You may be surprised to find hundreds of files in each of these subfolders. Using the WaRmZip utility, I can create a one line batch file to handle removing these log files, and then schedule this batch file to run weekly or monthly.

Here’s the one line batch command: “C:\WaRmZip17\WaRmZip.wsf” “C:\Windows\System32\LogFiles” /da:7 /r /q

In this example, the da:7 option says to delete files older than 7 days, the /r option says to process all sub folders, and the /q option says to run it quietly (non verbose). There are options to zip/compress these files instead, if that is your preference, or to move them to a different drive/folder.


Recreate Virtual IIS directories

This post comes via Ray and Damian at Microsoft, via Les!

Sometimes, things just get so screwed up that you want to re-create the virtual directories. I know the feeling. Thanks to Ray Fong and Damian Leibaschoff (both MS) for previous posts, here is how to do it.

In IIS, expand Default Web site and remove the following virtual directories:
– (Do not remove EXCHANGE-OMA)
Then, enable real time editing of the metabase in IIS admin, for this:
1. Open properties on the server object.
2. Check the box ‘Enable direct metabase edit’
3. After this, open windows explorer and navigate to the following directory: windows\system32\inetsrv
4. Edit metabase.xml (make a backup first) with notepad and navigate to the following section:  /LM/DS2MB/HighWaterMarks
5. Set the Value=”207778″ to zero or delete it.  This value will be located in a string value like the following (The value may be different):

 /LM/DS2MB/HighWaterMarks/{79F81D41-A652-4375-85F0-41A16037CC85} >
  Value=”207778″ <—– Set this to “0”
6. Alternatively, you can use Metaedit to make these changes.
7. Save the file.
8. Run IISRESET and then re-start the MsExchangeSA service.
The deleted virtual directories should get re-created after a few minutes from the information that Exchange keeps in Active Directory.
Les Connor [SBS Community Member]
SBS Rocks !

Tips to installing MELL – Microsoft e-Learning Library

Thanks to Jonathan for providing these notes:

Installing MELL on a Microsoft SBS 2003 Server
Step 1: Follow the steps to install MELL on a web server as outlined in the Mell 2.x Deployment Guide located here:
Step 2: Once completed, you’ll note that when trying to access MELL via http://servername/mell/eng, you get the following error:
 006~ASP 0175~Disallowed Path Characters~The ‘..’ characters are not allowed in the Path parameter for the MapPath method.

When attempting to access the reports via http://servername/mell/eng/reports, you’ll get the following error (if ‘Show 
friendly HTTP error messages’ is disabled in IE):   Microsoft VBScript runtime error ‘800a01f4’  Variable is undefined: ‘Session’  /mell/eng/reports/inc/, line 987
To resolve both of these issues, open Internet Information Services Manager > (Start–>All Programs–>Administrative Tools–Internet Information Services > (IIS) Manager).  Expand the server, expand the ‘Web Sites’ folder, and expand the ‘Default Web Site’.  Right-click on the folder named ‘MELL’, and select ‘Properties’.

On the Virtual Directory tab, click on the ‘Configuration’ button.  Go to the ‘Options’ tab.  Turn on the ‘Enable session state’ and ‘Enable parent paths’ options by checking them.  Click on OK twice.
Step 3: Restart Internet Information Services (Start–>Run–>’iisreset’).
That’s it!  Hope that helps someone.  
Jonathan Kok 

Changing the SSL port number used by OWA

A question was asked “How can I change the SSL port# used to access OWA?“. This response was provided by Ray Fong (assuming we want to change the port# from 443 to 10001:

1. Go to Exchange System Manager, Protocols -> HTTP. Right-click New HTTP Virtual Server.
2. Specify “Exchange OWA 10001” for the name.
3. Click Advanced, modify, change the port from 80 to 81. SSL port is not available, that’s OK.
4. After you click OK and Applied, go back to the same screen. Now remove port 81 and specify 10001 as the SSL port. Click OK all the way.
5. Follow the steps below to force the DS2MB replication.

a. Go to IIS, right-click servername (local computer), Properties. Backup/Restore Configuration to save a copy of IIS settings
b. Right-click servername (local computer), Properties. Check Enable Direct Metabase Edit.
c. Open MetaBase.xml with Notepad.
d. Locate the following object where ID = 61472

<IIsConfigObject  Location
ID=”61472″   (<—- This one)

e. Change the Value to “0”. Your original number will not be “53322”.
f. Save the file.
g. From a command prompt, type “iisreset”
h. Restart Exchange System Attendant

6. Now, OWA is available via https://FQDN:10001

Ray Fong
Microsoft SBS Product Support

Create Multiple Websites with one IP address (Host Headers)

Here are links to several web pages offering detailed information on using Host Headers: