Re: VBScript can't read NTBackup log files
- From: mabra <mabra@home>
- Date: Thu, 06 Jul 2006 14:23:21 +0200
Hi !
Have a look into the scripting reference:
object.OpenTextFile(filename[, iomode[, create[, format]]])
format
Optional. One of three Tristate values used to indicate the format of the opened file. If omitted, the file is opened as ASCII.
So, try:
Set LogFile=FSObj.OpenTextFile
("C:\LogTemp\backup01.log", ForReading, TristateTrue)
Regard, sometimes you must defines the constants by
yourself [use: true, -1] for above.
I am sure, NTBackup writes in Unicode, so this way should work.
Best regards,
Manfred
Ken Morley wrote:
Our company uses Windows 2003 Server and Exchange 2003, both of which are patched to the latest revision..
I would like to automate our Exchange backups. I have written a VBScript that backs up Exchange to a disk file. After the backup, I would like the script to delete the oldest backup file only if the backup was successful.
NTBackup does not return a useful exit code (see KB article 260327), so I can't use that obvious method of determining success or failure. So, I decided to open, read and parse the log files instead.
Even though the log files appear to be text files, my script returns the same three garbage characters from every NTBackup log file. I'm guessing that the characters are at the begining of the logs and Notepad just ignores them. VBScript must think they are EOF or something, because I can't read past them.
If I cut the text from a NTBackup log file and paste it into a text file, my script works fine. I've included the VBScript code demonstrating the problem below.
To complete this project, I need one of the following:
a version of NTBackup that returns a useful exit code;
a version of NTBackup that doesn't begin log files with garbage characters;
a VBScript that can read past the garbage characters;
an alternative method for determining NTBackup success/failure.
Any suggestions will be greatly appreciated!
Ken Morley
ken@xxxxxxxxxxxxxxx
* * * * * VBScript Code Follows * * * * *
Dim LogFile, FSObj
Set FSObj = CreateObject("Scripting.FileSystemObject")
' NTBackup log files are normally stored in:
' C:\Documents and Settings\Administrator.DOMAIN\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data.
' Logs were moved to C:\LogTemp for clarity.
Set LogFile=FSObj.OpenTextFile("C:\LogTemp\backup01.log")
WScript.Echo LogFile.ReadAll()
- Prev by Date: Re: How do i call a Login Script?
- Next by Date: Re: [PSH] How do I start new process and inherit all current shell var
- Previous by thread: How do i call a Login Script?
- Next by thread: Re: [PSH] How do I start new process and inherit all current shell var
- Index(es):
Relevant Pages
|