I use audit_list.vbs to populate our database. For this I usually use a file with all of our computer names: one computer name per line. So I have added following function to the script:
[code]
Function FileToArray(ByVal strFile, ByVal blnUNICODE)
Const FOR_READING = 1
Dim objFSO, objTS, strContents
' BEGIN CALLOUT A
FileToArray = Split("")
' END CALLOUT A
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(strFile) Then
On Error Resume Next
Set objTS = objFSO.OpenTextFile(strFile, FOR_READING, False, blnUNICODE)
If Err = 0 Then
strContents = objTS.ReadAll
objTS.Close
' BEGIN CALLOUT B
FileToArray = Split(strContents, vbNewLine)
' END CALLOUT B
End If
End If
End Function
[/code]
Furthermore I have replaced the line for the array assignment:
[code]
'pc_array = array ( "COMPUTERNAME1", "COMPUTERNAME2")
pc_array = FileToArray("C:\openaudit\other\computers.txt", False)
[/code]
FileToArray is a function I got from here:
http://www.windowsitpro.com/article/use ... rray-46489Would it be possible to include this function in future versions?
Best,
Denis