Move logs (VBScript)

This code can be found in Chapter 6 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 script moves the logs for the specified servers first storage group
' to the specified path. 

' ------ SCRIPT CONFIGURATION ------
 strServerName = "<serverName>"    ' e.g. "BATMAN"	
 strMDBName = "<mdbName>"
 strNewPath = "<newPath>"		' e.g. "c:\temp\"
 
 ' ------ END CONFIGURATION ---------
Set theServer = CreateObject("CDOEXM.ExchangeServer")
Set theSG = CreateObject("CDOEXM.StorageGroup")

theServer.DataSource.Open strServerName
' Get the array list of StorageGroups, then coerce it to get the first
' SG name
theSGArr = theServer.StorageGroups
theFirstSG = theSGArr(0)

strURL = "LDAP://" & theServer.DirectoryServer & "/" & theFirstSG
theSG.DataSource.Open strURL

' move the log filesto the specified path; this dismounts and remounts
' all of the SG's databases
theSG.MoveLogFiles strNewPath
WScript.Echo "Log files moved to" & strNewPath

This code has been viewed 808 times.

New from the creators of TechTasks.com: StatSheet.com