Interrogate and change message tracking properties (VBScript)
This code can be found in
Chapter 4 of Exchange Server Cookbook
Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.
Find out how to download all of the VBScript code from this site.
' This script was originally published in the Exchange Cookbook,
' (http://www.exchangebookcook.com). Written by Paul Robichaux,
' Missy Koslosky, and Devin Ganger. Redistributed with permission
' of the publisher, O'Reilly & Associates.
' This code uses WMI to interrogate and change message tracking
' properties on the specified server.
' ------ SCRIPT CONFIGURATION ------
strComputerName = "<serverName>" ' e.g. "BATMAN"
' ------ END CONFIGURATION ---------
strE2K3WMIQuery = "winmgmts://" & strComputerName &_
"/root/MicrosoftExchangeV2"
' Find each Exchange 2003 server and display its message tracking status.
' Then, turn on message tracking and subject display and set the
' log retention period to 7 days. Real code should include error checking here
Set serverList = GetObject(strE2K3WMIQuery).InstancesOf("Exchange_Server")
For each Exchange_Server in serverList
WScript.Echo "Server: " & Exchange_Server.Name
isEnabled = Exchange_Server.MessageTrackingEnabled
If (isEnabled) Then
WScript.echo " Message tracking already enabled"
Else
Exchange_Server.EnableMessageTracking(True)
End if
WScript.Echo " Current lifetime: " & Exchange_Server.MessageTrackingLogFileLifetime
Exchange_Server.MessageTrackingLogFileLifetime = 7
WScript.Echo " New lifetime: " & Exchange_Server.MessageTrackingLogFileLifetime
WScript.Echo " Current subject logging: " & Exchange_Server.SubjectLoggingEnabled
Exchange_Server.SubjectLoggingEnabled = True
WScript.Echo " New subject logging: " & Exchange_Server.SubjectLoggingEnabled
Exchange_Server.Put_
Next
|
This code has been viewed 1193 times.
|
New from the creators of TechTasks.com:
StatSheet.com
|