Bob,

I like your quick batch file for the forwards.  I played with it for a bit and
decided I didn't like temporary files.  I adapted it to a VB script file that
can I run from the command shell in Win2k.  Being in VBS format, I can easily
add in regular expressions to check for mail forwarding loops too (helpful
when migrating accounts from one domain to another).

simply run as "FastFwd.vbs \\server\d$\imail\users"  (use Cscript over
Wscript)

Here's a copy...

--------> Begin fastfwd.vbs <--------

Dim objShell, objFSO, objFolder, objTSfwd, folders
Dim strInFile, strOutFile
Dim imPath, user, strFwd

'imPath = "\\myserver\d$\imail\users"

If WScript.Arguments.Count = 1 Then
 If InStr(WScript.Arguments.Item(0), "?") Then Call Usage()
 imPath = WScript.Arguments.Item(0)
Else
 Call Usage()
End If

'Create File System Objects for opening files...

 Set objFSO = CreateObject("Scripting.FileSystemObject")

'List subfolders from Imail Users Directory...

 Set objFolder = objFSO.GetFolder(imPath)
 Set folders = objFolder.SubFolders

'Check each folder for a forward.ima file and report contents...

 For each folder in folders
  user = folder.Name
  strFwdFile = imPath & "\" & user & "\forward.ima"

  If objFSO.FileExists(strFwdFile) Then
   'WScript.Echo "Found: " & strFwdFile

   Set objTSfwd = objFSO.OpenTextFile(strFwdFile, 1, False)
   If Err.Number Then
      WScript.Echo "Unable to open & read '" & strFwdFile
    WScript.Quit(1)
   End If

   strFwd = objTSfwd.ReadLine
   WScript.Echo user & "|" & strFwd
   objTSfwd.Close
  End If
 Next

'Clean-up for variables & objects...

 Set objTSfwd = Nothing
 Set objFSO = Nothing
 Set objShell = Nothing

Wscript.Quit(0)

Sub Usage()
 WScript.Echo vbNewLine & "-=[ FastFwd.vbs ]=-"
 WScript.Echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" & vbNewLine
 WScript.Echo vbNewLine & " Usage:" & vbNewLine
 WScript.Echo vbTab & "> fastfwd.vbs \\server\d$\imail\users"
 WScript.Quit(0)
End Sub

--------> End fastfwd.vbs <--------


To Unsubscribe: http://www.ipswitch.com/support/mailing-lists.html
List Archive: http://www.mail-archive.com/imail_forum%40list.ipswitch.com/
Knowledge Base/FAQ: http://www.ipswitch.com/support/IMail/

Reply via email to