title: Appending to a file instead of overwritting the file everytime in VBScript
body: <p>I am just trying to make a log file here. I have tried doing something with <code>OpenTextFile</code> instead of <code>CreateTextFile</code>, but then it just writes nothing and I'm really not sure why and I'm having trouble finding the info I need.</p>
  
  <pre><code>'Nick Repella 10/29/13
  
  'Needed in case object does not exist (outdated list)
  On Error Resume Next
  
  Function IsCompDisabled(strLine)
      Dim objComputer
      objComputer = "LDAP://cn="
      objComputer = objComputer &amp; strLine
      objComputer = objComputer &amp; ",ou=HIDDENOU,dc=HIDDENDC,dc=HIDDENDC,dc=HIDDENDC"
      IsCompDisabled = GetObject(objComputer).AccountDisabled
  End Function 
  
  'Set the file to read computer names from (Change C:\scripts\text.txt to the 
  'target file)
  Set objFileToRead = CreateObject("Scripting.FileSystemObject").OpenTextFile("C:\scripts\text.txt", 1)
  
  Dim strLine
  
  Do While Not objFileToRead.AtEndOfStream
      strLine = objFileToRead.ReadLine()
      If (IsCompDisabled(strLine) = True) Then
          outFile="c:\scripts\compDisableCheck.log"
          Set objFSO = CreateObject("Scripting.FileSystemObject")
          Set objFile = objFSO.CreateTextFile(outFile, True)
          objFile.Write strLine &amp; "has been deleted"
          objFile.Close        
      Else
          WScript.Echo strLine &amp; " computer is enabled no action taken"
      End If
  Loop
  
  MsgBox "Done"
  </code></pre>