Registrations to Open-AudIT forums are now closed. To ask any new questions please visit Opmantek Community Questions.

Open-AudIT

What's on your network?
It is currently Fri Mar 29, 2024 5:37 am

All times are UTC + 10 hours




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 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
[/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-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: 205
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  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 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:  
Powered by phpBB® Forum Software © phpBB Group