Change garbage collection period (VBScript)

This code can be found in Chapter 17 of Active Directory Cookbook, 2nd edition

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 VBScript code changes the default garbage collection interval

' ---------------------------------------------------------------
' From the book "Active Directory Cookbook" by Robbie Allen
' ISBN: 0-596-00466-4
' ---------------------------------------------------------------

' ------ SCRIPT CONFIGURATION ------
intGarbageColl = <IntervalInHours>
' ------ END CONFIGURATION ---------

set objRootDSE = GetObject("LDAP://RootDSE")
set objDSCont = GetObject("LDAP://cn=Directory Service,cn=Windows NT," & _
             "cn=Services," & objRootDSE.Get("configurationNamingContext") )
objDSCont.Put "garbageCollPeriod", intGarbageColl
objDSCont.SetInfo
WScript.Echo "Successfully set the garbage collection interval to " & _
             intGarbageColl

This code has been viewed 2025 times.

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