Open-AudIT

What's on your network?
It is currently Thu Apr 19, 2018 11:45 pm

All times are UTC + 10 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Sat Jan 26, 2013 12:33 am 
Offline
Newbie

Joined: Wed Jan 09, 2013 6:43 am
Posts: 13
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


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)


FileToArray is a function I got from here:
http://www.windowsitpro.com/article/use ... rray-46489

Would it be possible to include this function in future versions?

Best,
Denis

_________________
You are running version beta9.2 of OAv2.
Your database platform is mysql (version 5.1.66).
Your web server is Apache/2.2.15 (CentOS) .

Mixed environment (Physical&Virtual):
~200x Windows, ~50x Linux, ~30x VMware hosts


Top
 Profile  
Reply with quote  
PostPosted: Thu Apr 11, 2013 3:11 am 
Offline
Contributor
User avatar

Joined: Thu Mar 02, 2006 4:41 am
Posts: 204
Location: Massachusetts
I made the changes, this works perfectly. Thank you for sharing

_________________
Server Info: running on a CentOS 7 vm
OA Version: 2.0.6 @ 500 devices


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 10 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group