So my vb program works inside of vs 2008 with the code below but when i build it and put it in windows home server it crashes. The problem is with the if statement. If i take it out the program works just fine. the if statement searches the output from the shell.
Code:schedule = "SCHTASKS /Create /SC " & Often & " /RU Administrator /RP " & password & " /ST " & TextTime.Text & ":00" & " /TN " & title & " /TR " & path & " > C:\copypal\slogs\" & title & ".txt" Shell("cmd /c" & schedule, vbHide) Dim sFileBuffer As String, sSearchValue As String, bValueExists As String sSearchValue = "SUCCESS:" 'Value you are searching for Dim oFile2 As System.IO.File Dim oRead2 As System.IO.StreamReader Dim keyread As String oRead2 = oFile2.OpenText("C:\copypal\slogs\" & title & ".txt") sFileBuffer = oRead2.ReadToEnd() If InStr(1, sFileBuffer, sSearchValue, vbTextCompare) <> 0 Then MsgBox(title & " has sucessfully been saved.") Else MsgBox(title & " failed. Please view the log located at C:\copypal\slogs\" & title & ".txt") End If




Reply With Quote