I cannot get vbscript to read NT backup logs.

To get the problem in a nutshell, I use this code fragment:

Set objFSO = CreateObject("Scripting.FileSytemObject")
Set objFile = objFSO.OpenTextFile("C:\backup01.log", 1)
strContents - objFile.Readall
wscript.echo strContents
objFile.Close

Now, replace backup01.log with any text file, and it reads just fine. But
try to read the log, and I get ÿ_B . Renaming the log file to .txt doesn't
make a difference.

Is there a way to list the contents of those log files? I'm using the
output to send email with the contents of the logfile rather than attaching
the logfile itself.


Thanks,

---Holly

Re: reading backup logs by petal

petal
Thu Jul 17 19:03:31 CDT 2003

the logs are Unicode - need to open as such
also a couple of syntax errors(?)

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\backup01.log", 1,,-1)
strContents = objFile.Readall
wscript.echo strContents
objFile.Close

regards
petal

"HollyB" <holly.bertolett@remove.bus.utexas.edu> wrote in message
news:bf6huv$dbv$1@geraldo.cc.utexas.edu...
> I cannot get vbscript to read NT backup logs.
>
> To get the problem in a nutshell, I use this code fragment:
>
> Set objFSO = CreateObject("Scripting.FileSytemObject")
> Set objFile = objFSO.OpenTextFile("C:\backup01.log", 1)
> strContents - objFile.Readall
> wscript.echo strContents
> objFile.Close
>
> Now, replace backup01.log with any text file, and it reads just fine. But
> try to read the log, and I get ÿ_B . Renaming the log file to .txt doesn't
> make a difference.
>
> Is there a way to list the contents of those log files? I'm using the
> output to send email with the contents of the logfile rather than
attaching
> the logfile itself.
>
>
> Thanks,
>
> ---Holly
>
>