title: how to add a log to my vbscript
body: <p>i have this script that reads a list of computers and check to see if the computers have the right software version install. the script echo to me the computers with the wrong version, but i want to make a log instead </p>
  
  <pre><code>Dim strComputer, objFSO, ObjShell, strDisplayName, objList, strObject
  Dim objReg, arrSubKeys, strProduct, strVersion, strReqVersion
  Const For_Writing = 2
  Const ForReading = 1
  const ForAppending = 3
  Const HKLM        = &amp;H80000002
  Const strKeyPath  = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
  strReqVersion = "8.2.1 MP2"
  Set objFSO = CreateObject("Scripting.FileSystemObject")
  Set objShell = CreateObject("WScript.Shell")
  Set objList = objFSO.OpenTextFile("c:\test\test.txt",ForReading)
  Do While Not objList.AtEndOfStream
      strComputer = objList.ReadLine
      If HostOnline(strComputer) = True Then 
         Inventory(strComputer)
      End If 
  Loop 
  Function Inventory(strComputer)
  Set objTextFile = objFSO.OpenTextFile("c:\test\inventory.txt",2,true)
  'creating a dictionary object
  Set objDictionary = CreateObject("Scripting.Dictionary")
  Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &amp; _ 
       strComputer &amp; "\root\default:StdRegProv")
       ' Enumerate the subkeys of the Uninstall key
      objReg.EnumKey HKLM, strKeyPath, arrSubKeys
      For Each strProduct In arrSubKeys
    ' Get the product's display name
          objReg.GetStringValue HKLM, strKeyPath &amp; "\" &amp; strProduct, "DisplayName", strDisplayName
    ' Process only products whose name contain 'symantec'
          If InStr(1, strDisplayName, "Symantec", vbTextCompare) &gt; 0 Then
      ' Get the product's display version
          objReg.GetStringValue HKLM, strKeyPath &amp; "\" &amp; strProduct, "DisplayVersion", strVersion
          If strReqVersion &lt;&gt; strVersion Then
              WScript.Echo strObject
              objDictionary.Add strComputer, strVersion
              For Each strObject In objDictionary
               WScript.Echo strObject
  
               objTextFile.WriteLine(strObject)
              Next   
              objTextFile.Close               
           End If    
          End If  
      Next
  End Function
  Function HostOnline(strComputername)
  '---------- Test to see if host or url alive through ping -----------------
  ' Returns True if Host responds to ping
  ' 
  ' strComputername is a hostname or IP 
      Const OpenAsASCII = 0 
       Const FailIfNotExist = 0 
       Const ForReading =  1 
       Dim objShell, objFSO, sTempFile, fFile 
      Set objShell = CreateObject("WScript.Shell") 
       Set objFSO = CreateObject("Scripting.FileSystemObject") 
      sTempFile = objFSO.GetSpecialFolder(2).ShortPath &amp; "\" &amp; objFSO.GetTempName 
      objShell.Run "cmd /c ping -n 2 -l 8 " &amp; strComputername &amp; "&gt;" &amp; sTempFile, 0 , True 
      Set fFile = objFSO.OpenTextFile(sTempFile, ForReading, FailIfNotExist, OpenAsASCII) 
      Select Case InStr(fFile.ReadAll, "TTL=") 
           Case 0
              HostOnline = False 
           Case Else
              HostOnline = True 
      End Select 
      ffile.close 
       objFSO.DeleteFile(sTempFile)
      Set objFSO = Nothing
      Set objShell = Nothing
  End Function
  </code></pre>
  
  <p>can some one help me please thanks</p>