I have been meaning to add this code for a while, but there have been other changes going on with the audit.vbs file which made my original idea "break" audit.vbs.
What I have done is add in a line at the start of the audit.vbs file.
[code]
this_config_url = "http://localhost/openaudit/scripts/audit.config.defaults"
[/code]
and the following section
[code]
dim filesys
Set filesys = CreateObject("Scripting.FileSystemObject")
'
If not filesys.FileExists(this_config) Then
'
' This section takes a look at the local audit.config, and if there is none, it makes one from the server URL
' The idea is to allow us to throw the audit.vbs file to a browser and have it grab the config it needs.
' We should only need to set one thing, namely the URL from which we will grab the remainder of the config.
'
'
' We assume the local config file will always be audit.config
this_config = "audit.config"
' Now we open the web page where the remote config lives
Set WshShell = WScript.CreateObject("WScript.Shell")
Set http = CreateObject("Microsoft.XmlHttp")
' ...and we grab it..
http.open "GET",this_config_url, FALSE
http.send ""
'
Set config_file = CreateObject("Scripting.FileSystemObject")
Set our_config = config_file.OpenTextFile( this_config, ForWriting, True)
'... and post it to our local config.
our_config.write http.responseText
End If
' End of web config script.
'
' break (this is a good point to break if testing the config)
[/code]
This URL is checked
if there is no local audit.config file,. A set of defaults are send to the audit.vbs from the URL which audit.vbs then writes to the local audit.config file.
The idea being that we can script this in such a way that when we need to create a new audit for or from a new location, we simply modify this url.
We then create a new audit.config.(location) file on the web server and run the audit.vbs from wherever we want.
Since the only change we need is the first line of audit.vbs, we can easily script this on the web server.
Therefore we can now store all of the config info in pages on the server. We can also create new locations on the web server with an Audit This Location button which will throw back a suitably modified audit.vbs
If this is not clear let me know and I will explain further.
The mod should do nothing if audit.config already exists.
Please read the next section carefully: Proceed with caution....
To test, copy your current audit.config (just in case) and modify audit.config.defaults on the web server to match.
Now mod the URL at the start of the new audit.vbs to point to the web server, note you are best using the Fully qualified name of the server rather than localhost, even if you are running mainly from the OA host, if you do this the script will theoretically work from wherever you want to run it.
PLEASE NOTE as it stands there is not check for the validity of this URL, so if audit.vbs breaks at abot line 61, check the URL and the config file.
Remove the existing audit.config. (Thats why I told you to take a copy of it... What do you mean you weren't listening!
)
Now run audit.vbs magically your audit.config should re-appear and the audit should go smoothly as before.