Hi * I have been staring at this problem for too long now and I need it fixed. We have some rather large transaction logs on our MSSQL2005 servers because some backups went wrong for some time. Now that the backups are a-ok again, I need to shrink those logfiles, and I could do that from osql with dbcc shrinkfile, but I'd rather make it stick - so I thought I'd put it in as part of the TDP backup cycle. However, I cannot figure out how to do it. I do not have powershell installed on the machines, so that is out. DMO is a way to go, but will be discontinued, so why bother and I just can't get it right with SMO and VBScript - I'm no expert in VBScripting, but with the right examples I usually can manage something that seems pretty basic to me as lined out below...
What I need is: 1. Check what databases are on the server (as new databases are added over time I do not wish to rewrite the script every time) 2. Get the physical names of the logfiles for each and every one of those databases 3. Shrink the logfiles so it will free up diskspace. @2 - I might need to add an extra check to make sure I only shrink the logfiles of the databases that are in full recovery mode. I'm sure people are doing this - otherwise all the transaction logs would be way too big - but I just cannot find the info I need. I was hoping maybe you could help... Cheers, Rick