Guys,
Can someone point me in the right direction on this ?
Set objNetwork = CreateObject("WScript.Network")
Set WshShell = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
dtmThisDay = "01"
dtmThisMonth = Month(Date)
dtmThisYear = Year(Date)
strcom1 = "Uptime /d:"
strcommand = strcom1 & dtmThisDay & "/" & dtmThisMonth & "/" & dtmThisYear & " > "
strOutput = "Uptime-" & dtmThisDay & "-" & dtmThisMonth & "-" & dtmThisYear & ".txt"
strComputer = "."
MyLine = "cmd.exe /c " & strcommand & strOutput
WshShell.Run MyLine
Set objFile = objFSO.OpenTextFile(strOutput, 1)
strLine = objFile.ReadAll
objFile.Close
Set objFile = Nothing
Wscript.Sleep 600
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "blah blah"
objEmail.To = "my email add"
objEmail.Subject = "server Monthly Uptime Report"
objEmail.Textbody = strLine
objEmail.Send
Set objEmail = Nothing
This creates the file etc but when it comes to the email part i get an error >>>
D:\Uptime\uptime.vbs(28, 1) CDO.Message.1: The process cannot access the file because it is being used by another process.
I've closed the file so why's it still in use?
TIA
Keyboard Not Detected.....
Press F1 to Continue.
:}
Can someone point me in the right direction on this ?
Set objNetwork = CreateObject("WScript.Network")
Set WshShell = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
dtmThisDay = "01"
dtmThisMonth = Month(Date)
dtmThisYear = Year(Date)
strcom1 = "Uptime /d:"
strcommand = strcom1 & dtmThisDay & "/" & dtmThisMonth & "/" & dtmThisYear & " > "
strOutput = "Uptime-" & dtmThisDay & "-" & dtmThisMonth & "-" & dtmThisYear & ".txt"
strComputer = "."
MyLine = "cmd.exe /c " & strcommand & strOutput
WshShell.Run MyLine
Set objFile = objFSO.OpenTextFile(strOutput, 1)
strLine = objFile.ReadAll
objFile.Close
Set objFile = Nothing
Wscript.Sleep 600
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "blah blah"
objEmail.To = "my email add"
objEmail.Subject = "server Monthly Uptime Report"
objEmail.Textbody = strLine
objEmail.Send
Set objEmail = Nothing
This creates the file etc but when it comes to the email part i get an error >>>
D:\Uptime\uptime.vbs(28, 1) CDO.Message.1: The process cannot access the file because it is being used by another process.
I've closed the file so why's it still in use?
TIA
Keyboard Not Detected.....
Press F1 to Continue.
:}