I've worked on an addition to audit.vbs so that it accepts named arguments. The only audit.config parameters it doesn't accept from the command line are the email ones. I can always add them...I just wasn't sure if it was worth it. I also added an option to specify an audit.config from the command line, which seems to satisfy a fixme in the script.
I added it in such a way that it shouldn't interfere with how the script previously worked. All previous ways the script was used should still work as expected. However, I did notice that there was support for unnamed arguments in the script. Given the logic of the script, I'm not sure if they ever worked or what the intention was with them. It looks like maybe it was meant so that you could override the strComputer, strUser, and strPass so long as you still had an audit.config available. In any case, I left the support in for those unnamed arguments as well.
A few advantages to this ...
- You can use several different audit.configs without needing to hardcode config paths in the script or use multiple audit.vbs files.
- You can use command line arguments only if you want to, no audit.config neccessary.
- You can use a single audit.config but override certain parts with command line arguments if you want.
One odd thing I noticed is that the script defines that the logic should be this...
[code]
' look for audit.config and use that, if it doesn't exist, grab it from
' the web server, if we cant do that, then use the internal defaults.
' Finally modify the defaults depending on any command line switches
[/code]
However, currently, if the script cannot grab the audit.config from the server the script just fails. The main reason this happens is because a default is set at the top of the script that defines the URL for where to get the script. Should it just check if a URL is set (it only seems to be set if you would launch it from the web interface), and if it isn't set and no config is set and it isn't set to only use command line arguments, then set some defaults?
Any objections to this or the approach I'm using? I've attached the patch and file if someone wants to give it a try. The main way to use it with named arguments is to just do 'cscript audit.vbs /strComputer:." and so on for each audit.config entry. You can run 'cscript audit.vbs /help' for usage information.