Re: are scripts allowed in exchange 2003?
anonymous_at_discussions.microsoft.com
Date: 08/30/04
- Next message: Ben Winzenz [Exchange MVP]: "Re: OWA configuration"
- Previous message: Chris Scharff [MVP]: "Re: Proper of disabling account"
- In reply to: Bob Christian: "Re: are scripts allowed in exchange 2003?"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 30 Aug 2004 11:04:05 -0700
Also, here is the code for one of the scripts stored
under the "Agent" tab of a public folder's properties in
exchange 5.5:
<SCRIPT RunAt=Server Language=VBScript>
'---------------------------------------------------------
---------------------
'FILE DESCRIPTION: Exchange Server Event Script
'
' This Script, intending to clean up messages from the
root(##) of the public
' folders to be processed. At the scheduled time, the
script will be
' executed, examining all its subfolders. If a
particular folder has
' subfolder ".Email - Previous Week", then the script
will move all the
' messages received more than two days ago to the ".Email-
Previous
' Week" folder and all messages originally in
the ".Email - Previous Week" folder
' will be deleted.
'
' Parameters:
' RootID - FolderID of the "root" of all the Public
folders to be
' processed
'
'!! IMPORTANT NOTE: one MUST have permissions to ALL
subfolders under
' the "root" directory. Otherwise,
there will be errors
'
'## Note: The "root" of the public folders need to be
identified by its
' FolderID.
'^^ Note: ".Email - Previous Week" folder can be placed
anywhere in the
' directories except immediately under the
folder where the script
' is located
'---------------------------------------------------------
---------------------
Option Explicit
'---------------------------------------------------------
---------------------
' Global Variables
'---------------------------------------------------------
---------------------
dim g_debug 'Debug
log string
Dim oSession 'Session
Object
'---------------------------------------------------------
---------------------
' Event Handlers
'---------------------------------------------------------
---------------------
' DESCRIPTION: This event is fired when the timer on the
folder expires
Public Sub Folder_OnTimer
Dim oRootFolder 'Root Folder
Dim RootID 'Root Folder's ID
'*******************************PARAMETER(S)
************************************
' Current Selected: "All Public Folders\hwo new"
RootId
= "000000001A447390AA6611CD9BC800AA002FC45A0300C0B86B30DBD
611CEB31700AA00574CC60000000000030000"
'*********************************************************
**********************
' Clear error buffer
Err.Clear
' Get Session info
Set oSession = EventDetails.Session
' Get the Root Folder
Set oRootFolder = oSession.GetFolder(RootID, NULL)
Recur(oRootFolder.Folders) 'Call
Recursive Function
Script.Response = g_debug 'Write to Log
End Sub
'---------------------------------------------------------
-------------------
'Recursive function to find Previous Week folder
' *Takes Folder _Collection_ as a parameter
'---------------------------------------------------------
-------------------
Sub Recur(CFs)
Dim found
Dim i
Dim j
Dim CF
Dim PWID
Dim PWFolder
Dim CFF
Dim Tfolder
found = 0 'Initialization -
not found
'Check all 1st subfolders of current folder
For i = 1 to CFs.Count
Set CF = CFs.Item(i)
'Check if subfolder has a Previous Week
subfolder
Set CFF = CF.Folders
Set Tfolder = CFF.GetFirst
For j = 1 to CFF.Count
If ( Tfolder.Name = ".Email -
Previous Week") Then
found = 1
'set flag
PWID = Tfolder.ID
'Get ".Email - Previous Week" folderID
Chk CF, PWID
'process items in the folder
End if
Set Tfolder = CFF.GetNext
Next
'Case if no Previus Week subfolder found
but has other subfolders
if (CF.Folders.Count > 0) Then
Recur(CF.Folders)
'chk its subfolders for Prev Week folder
End if
found = 0
Next
End Sub
'---------------------------------------------------------
------------
'Process items in folder
'---------------------------------------------------------
------------
Sub Chk(CF, CPFid)
Dim CPF 'Previous Week
folder
Dim numCPF 'num of mesgs in
CPF
Dim numItem 'num of mesgs in
current folder
Dim recvDate 'Received Time of
the mesg
Dim CItem 'Current Mesg
Dim x 'Index counter
Dim ind 'Index counter
Dim y 'Index counter
Dim numMoved 'num of mesgs
moved
'Initialization
numMoved = 0
'Get Previous Week Folder
Set CPF = oSession.GetFolder(CPFid, NULL)
'Delete Mails in Previous Wk folder
numCPF = CPF.Messages.Count
For y = 1 to numCPF
CPF.Messages.item(1).Delete
Next
' Process Mesg in current folder - move mesg to
Previous Week folder if
' mesg older then two days
numItem = CF.Messages.Count 'Total num of
mails to be proccess
ind = 1
For x = 1 to numItem
Set CItem = CF.Messages.item(ind)
recvDate = DateValue(CItem.TimeReceived)
if recvDate <= (Date - 2) Then
'Move item if older then two days
CItem.MoveTo CPFid
numMoved = numMoved + 1
Else
Ind = ind+1
End if
Next
g_debug = g_debug & numMoved & " mesgs Moved
from " & CF.Name & "; "
End Sub
</SCRIPT>
>-----Original Message-----
>Can you give us a bit more information regarding your
scripts? Are they VBS
>accessing WMI information, batch files utilizing
resource kit (reskit)
>utilities, etc.
>Scripting works with Exchange 2003 and Active
Directory...I tinker with
>VBScripts. I have also used batch scripts to manage
Exchange 2000 with the
>reskit utils.
>
>Bob
>"gigi" <anonymous@discussions.microsoft.com> wrote in
message
>news:26b401c48e4a$8ed40440$a501280a@phx.gbl...
>> I used to run a few scripts in exchange 5.5, and now
that
>> I'm upgrading to 2003 I can't find how to implement
these
>> scripts. How do I keep using my scripts from exchange
>> 5.5 in exchange 2003?
>
>
>.
>
- Next message: Ben Winzenz [Exchange MVP]: "Re: OWA configuration"
- Previous message: Chris Scharff [MVP]: "Re: Proper of disabling account"
- In reply to: Bob Christian: "Re: are scripts allowed in exchange 2003?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|