Purge unused Exchange 2007 Transaction Logs

Author Message
turranx

  • Total Posts : 59
  • Scores: 0
  • Reward points : 0
  • Joined: 2/7/2006
  • Location: Cincinnati, OH
  • Status: offline
Purge unused Exchange 2007 Transaction Logs Monday, June 09, 2008 4:39 AM (permalink)
0
My company is migrating from Exchange 2000 to Exchange 2007.  Our E2000 server contains roughly 90 Gig worth of Public Folder, Mail, & Calendar data.  While simulating the migration in a Virtual Server environment I discovered that E2007 was generating a lot of transaction log files.  I wrote this PowerShell script to purge the unneeded log files.  At any given moment E2007 is using the newest X number of log files that exist.  As a new one is added, the oldest log file in the relevant set becomes unneeded.  I read about this in the following link: http://searchexchange.techtarget.com/tip/0,289483,sid43_gci1187056,00.html
 
This code removes all the unneeded log files from the First Storage Group for a default installation of Exchange 2007.
 $temp = (eseutil /mk "C:\Program Files\Microsoft\Exchange Server\Mailbox\First Storage Group\E00.chk")[13]
 $Bottom_Log_File = $temp.remove($temp.IndexOf(",")).remove(0,$temp.IndexOf("x")+1)
 Get-ChildItem "C:\Program Files\Microsoft\Exchange Server\Mailbox\First Storage Group" | Where-Object { $_.Name.Length -eq 15 -AND $_.Name -like "E00*.log" -AND $_.Name.Substring(3+8-$Bottom_Log_File.length,$Bottom_Log_File.length) -lt $Bottom_Log_File } | foreach($_) {remove-item $_.fullname}
 

 
Save it inside "Purge_Exchange_Transaction_Logs.ps1" and use Task Scheduler to run the process as often as necessary.  I run this process every 10 minutes during a massive import and less often when the import/migration is finished.
Microsoft Windows 2000 Scripting Guide - The best book for newbie scripters
http://www.myspace.com/Evil__Overlord
 
#1
    jbgantes

    • Total Posts : 3
    • Scores: 0
    • Reward points : 0
    • Joined: 11/5/2008
    • Status: offline
    RE: Purge unused Exchange 2007 Transaction Logs Tuesday, November 11, 2008 2:07 PM (permalink)
    0
    New to PowerShell and tried your script -- not sure what this meant:

    powershell.exe -noexit D:\Purge_Exchange_T_Logs_3rdSGroup_LCR.ps1

    Method invocation failed because [System.Object[]] doesn't contain a method named 'IndexOf'.
    At D:\BGI\Purge_Exchange_T_Logs_3rdSGroup_LCR.ps1:3 char:75
    + $Bottom_Log_File = $temp.remove($temp.IndexOf(",")).remove(0,$temp.IndexOf( <<<< "x")+1)

    Thanks!
     
    #2
      jbgantes

      • Total Posts : 3
      • Scores: 0
      • Reward points : 0
      • Joined: 11/5/2008
      • Status: offline
      RE: Purge unused Exchange 2007 Transaction Logs Tuesday, November 11, 2008 9:12 PM (permalink)
      0
      My error, bracket missing on the ' [13] ' at the end.

      THANKS AGAIN FOR THE GREAT SCRIPT!
       
      #3
        abdul_waheed384@hotmail.com

        • Total Posts : 2
        • Scores: 0
        • Reward points : 0
        • Joined: 1/7/2011
        • Status: offline
        RE: Purge unused Exchange 2007 Transaction Logs Friday, January 07, 2011 10:25 AM (permalink)
        0
        i am getting following error in windows power shell... any idea ?
         
        Exception calling "Remove" with "1" argument(s): "StartIndex cannot be less tha
        n zero.
        Parameter name: startIndex"
        At C:\Users\abdul.waheed\Desktop\poooooo.ps1:2 char:33
        +  $Bottom_Log_File = $temp.remove( <<<< $temp.IndexOf(",")).remove(0,$temp.Ind
        exOf("x")+1)
         
         
         
        #4
          abdul_waheed384@hotmail.com

          • Total Posts : 2
          • Scores: 0
          • Reward points : 0
          • Joined: 1/7/2011
          • Status: offline
          RE: Purge unused Exchange 2007 Transaction Logs Sunday, January 09, 2011 7:30 PM (permalink)
          0
          i have fourth storage group configured. what changes i need to make for that ???
           
          #5
            jimmy1

            • Total Posts : 1
            • Scores: 0
            • Reward points : 0
            • Joined: 1/20/2011
            • Status: offline
            RE: Purge unused Exchange 2007 Transaction Logs Friday, January 21, 2011 12:01 AM (permalink)
            0
            hi guys,,,
            nice discussion is going on ,,,,
            i really enjoyed it,,,, and also
            helpful for me ,,,
            it should be helpful for every one,,,
            thanks,,,,
             
            #6

              Online Bookmarks Sharing: Share/Bookmark

              Jump to:

              Current active users

              There are 0 members and 1 guests.

              Icon Legend and Permission

              • New Messages
              • No New Messages
              • Hot Topic w/ New Messages
              • Hot Topic w/o New Messages
              • Locked w/ New Messages
              • Locked w/o New Messages
              • Read Message
              • Post New Thread
              • Reply to message
              • Post New Poll
              • Submit Vote
              • Post reward post
              • Delete my own posts
              • Delete my own threads
              • Rate post

              2000-2012 ASPPlayground.NET Forum Version 3.9