Hi,
The following script works exactly as expected except when i try to email
very large files. The emails are are either never sent or never received.
How do compress the NTFS (compress.exe does not work on NTFS files) file to
make it small enough to be emailed? Also how do I uncompress it with a
script when I receive it?
Thanks in Advance,
Rowland
'**********************************************************
'
' *** add client specific constants Here
const FBEGIN = "WEBEXTD"
const FPATH = "C:\Program Files\Microsoft ISA Server\ISALogs\"
const TOADDRESS = "mbox@server.com"
const FROMADDRESS = "server@someserver.com"
'
'**********************************************************
Set oNet = CreateObject("Wscript.Network")
sDomain = oNet.userDomain
eDate=changeDate(date())
strSubject = sDomain & " WEB LOGS " & eDate
set objFSO = CreateObject("Scripting.FileSystemObject")
dp=datepart("w",date())
randomize
upperbound=5
lowerbound=1
do
x = int((upperbound - lowerbound + 1) * Rnd + lowerbound)
select case x
case 1
theDate=date() - (dp+1)
case 2
theDate=date() - (dp+2)
case 3
theDate=date() - (dp+3)
case 4
theDate=date() - (dp+4)
case 5
theDate=date() - (dp+5)
end select
newDate=changeDate(theDate)
webDate=changeToWebDate(newDate)
fileName=FBEGIN & webDate & ".log"
fullPath=FPATH & fileName
loop until objFSO.FileExists(fullPath)=true
Dim iMsg
Set iMsg = CreateObject("CDO.Message")
With iMsg
.from = FROMADDRESS
.To = TOADDRESS
.Subject = strSubject
.TextBody = "Here is The Web Log File. " & fullPath
.AddAttachment(fullPath)
.Send
End With
set iMsg = nothing
function changeToWebDate(strDate)
x=split(strDate,"/",-1)
if len(x(0))=1 then x(0)="0" & x(0)
if len(x(1))=1 then x(1)="0" & x(1)
changeToWebDate=x(2) & x(0) & x(1)
end function
function changeDate(strDate)
fwdSlash=instr(strdate,"/")
hyphen=instr(strDate,"-")
period=instr(strDate,".")
if fwdSlash > 0 then delimiter="/"
if hyphen > 0 then delimiter="-"
if period > 0 then delimiter="."
x=split(strDate,delimiter,-1)
if strcomp(left(x(0),1),"0")=0 then x(0)=right(x(0),1)
if strcomp(left(x(1),1),"0")=0 then x(1)=right(x(1),1)
if len(x(2))=2 then x(2)="20" & x(2)
changeDate=x(0) & "/" & x(1) & "/" & x(2)
end function