NOTE:
Run the script as Local System User.
import os
import subprocess
from os import walk
def log(filename):
cmd = 'tracerpt '+filename+' -of CSV -y'
os.chdir("C:\\Windows\\Logs\\WindowsServerBackup")
obj = subprocess.Popen(cmd, shell=True, stdout = subprocess.PIPE, stderr = subprocess.PIPE)
out, err = obj.communicate()
if err:
print(err)
else:
print(' '+filename+' Log')
with open("C:\\Windows\\Logs\\WindowsServerBackup\\summary.txt",'r') as f:
print(f.read())
files = []
for (dirpath, dirnames, filenames) in walk("C:\\Windows\\Logs\\WindowsServerBackup"):
for k in filenames:
if k.endswith(".etl"):
files.append(k)
break
if len(files)> 0:
for file in files:
if file.endswith(".etl"):
log(file)
else:
pass
else:
print("No Backup Logs Found...!")
Comments